From 8b6758774e28151bb30f72232d5af9f01833b120 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 4 Jun 2015 14:24:36 +0200 Subject: [PATCH] Provide new option --remove-configs to delete grml-debootstrap configuration files from installed system Fixes #66 @ github --- cmdlineopts.clp | 5 ++++- config | 5 +++++ grml-debootstrap | 8 ++++++++ grml-debootstrap.8.txt | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cmdlineopts.clp b/cmdlineopts.clp index 0a46fc9..7e9ed45 100644 --- a/cmdlineopts.clp +++ b/cmdlineopts.clp @@ -12,7 +12,7 @@ # should be handled in the main script, where it belongs. ################################################################################ -CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,defaultinterfaces,interactive,nodebootstrap,nointerfaces,nokernel,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,post-scripts:,pre-scripts:,debconf:,vm,vmfile,vmsize:,keep_src_list,hostname:,password:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,arch:,insecure,verbose,help,version,force,debug,contrib,non-free +CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,defaultinterfaces,interactive,nodebootstrap,nointerfaces,nokernel,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,post-scripts:,pre-scripts:,debconf:,vm,vmfile,vmsize:,keep_src_list,hostname:,password:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,arch:,insecure,verbose,help,version,force,debug,contrib,non-free,remove-configs _opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \ $CMDLINE_OPTS -- "$@"` @@ -144,6 +144,9 @@ while :; do --non-free) # Add 'non-free' to list of components _opt_non_free=T ;; + --remove-configs) # Drop config files from installed system + _opt_remove_configs=T + ;; # == Other options --verbose|-v) # Increase verbosity diff --git a/config b/config index fe4e1d5..f969aca 100644 --- a/config +++ b/config @@ -219,4 +219,9 @@ # Default: '26ada0c0-1165-4098-884d-aafd2220c2c6' # DISK_IDENTIFIER="$(uuidgen)" +# Delete grml-debootstrap configuration files from installed system. +# Useful for reproducible builds or if you don't want to leak information. +# Default: 'no' +# REMOVE_CONFIGS='yes' + ## END OF FILE ################################################################# diff --git a/grml-debootstrap b/grml-debootstrap index 1e7b598..d783f26 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -157,6 +157,7 @@ Configuration options: --chroot-scripts Execute chroot scripts from specified directory. --pre-scripts Execute scripts from specified directory (before chroot-scripts). --scripts Execute scripts from specified directory (after chroot-scripts). + --remove-configs Delete grml-debootstrap configuration files from installed system. Other options: @@ -244,6 +245,12 @@ cleanup() { einfo "Removing ${STAGES}" ; rmdir "$STAGES" ; eend $? fi + if [ "$REMOVE_CONFIGS" = "yes" ] ; then + einfo "Removing configuration files from installed system as requested via --remove-configs / REMOVE_CONFIGS." + rm -rf "${MNTPOINT}"/etc/debootstrap/ + eend $? + fi + # Remove temporary mountpoint again if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then rmdir "$MNTPOINT" 2>/dev/null @@ -405,6 +412,7 @@ fi [ "$_opt_force" ] && FORCE=$_opt_force [ "$_opt_verbose" ] && VERBOSE="-v" [ "$_opt_debug" ] && DEBUG="true" +[ "$_opt_remove_configs" ] && REMOVE_CONFIGS="yes" # make sure main is always included [ -z "$COMPONENTS" ] && COMPONENTS="main" diff --git a/grml-debootstrap.8.txt b/grml-debootstrap.8.txt index 3c1febb..a836fa8 100644 --- a/grml-debootstrap.8.txt +++ b/grml-debootstrap.8.txt @@ -204,6 +204,11 @@ Options and environment variables squeeze, wheezy, jessie, stretch (note: requires a recent version of debootstrap) and sid. Corresponding with configuration variable RELEASE. +*--remove-configs*:: + + Delete grml-debootstrap configuration files (/etc/debootstrap/*) from installed + system. Useful for reproducible builds or if you don't want to leak information. + *-t*, *--target* _target_:: Target partition (/dev/...) or directory (anything else without /dev at the -- 2.1.4