X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=b013ec209acb42c3d0c00f0e9cb18192aea5a651;hp=1e7b598eaa7dc01ef2a0e1000ca2ce0b9014027b;hb=2a43ef77b386aef949070ca1828a2019569fca9a;hpb=a8c2e5f14dc2a1892c99acfc54a32efe5748b07c diff --git a/grml-debootstrap b/grml-debootstrap index 1e7b598..b013ec2 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" @@ -1419,7 +1427,7 @@ iface eth0 inet dhcp # execute all scripts in /etc/debootstrap/pre-scripts/ {{{ execute_pre_scripts() { # make sure hostname is set even before chroot-script get executed - echo "$HOSTNAME" > /etc/hostname + echo "$HOSTNAME" > "$MNTPOINT"/etc/hostname # make sure we have $MNTPOINT available for our scripts export MNTPOINT @@ -1441,7 +1449,7 @@ execute_post_scripts() { # make sure we have $MNTPOINT available for our scripts export MNTPOINT - if [ -d "$_opt_scripts" ] || [ "$SCRIPTS" = 'yes'] ; then + if [ -d "$_opt_scripts" ] || [ "$SCRIPTS" = 'yes' ] ; then # legacy support for /etc/debootstrap/scripts/ [ -d "$_opt_scripts" ] && post_scripts="$_opt_scripts" || post_scripts="${CONFFILES}/scripts/" ewarn "Deprecation NOTE: --scripts/SCRIPTS are deprecated, please switch to --post-scripts/POST_SCRIPTS instead."