Provide new option --remove-configs to delete grml-debootstrap configuration files...
authorMichael Prokop <mika@grml.org>
Thu, 4 Jun 2015 12:24:36 +0000 (14:24 +0200)
committerMichael Prokop <mika@grml.org>
Thu, 4 Jun 2015 12:56:02 +0000 (14:56 +0200)
Fixes #66 @ github

cmdlineopts.clp
config
grml-debootstrap
grml-debootstrap.8.txt

index 0a46fc9..7e9ed45 100644 (file)
@@ -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 (file)
--- a/config
+++ b/config
 # 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 #################################################################
index 1e7b598..d783f26 100755 (executable)
@@ -157,6 +157,7 @@ Configuration options:
       --chroot-scripts <d> Execute chroot scripts from specified directory.
       --pre-scripts <dir>  Execute scripts from specified directory (before chroot-scripts).
       --scripts <dir>      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"
index 3c1febb..a836fa8 100644 (file)
@@ -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