Provide new option --remove-configs to delete grml-debootstrap configuration files...
[grml-debootstrap.git] / grml-debootstrap
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"