From bedb4090c2608ad8f9fe94e6f2b032c8f438b82c Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 4 Jun 2015 13:38:30 +0200 Subject: [PATCH] Provide hostname to pre-scripts by setting up /etc/hostname While at it fix coding style and quoting of execute_pre_scripts() function. Fixes #54 @ github --- grml-debootstrap | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 5e30e00..104f454 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -1407,17 +1407,21 @@ iface eth0 inet dhcp # execute all scripts in /etc/debootstrap/pre-scripts/ {{{ execute_pre_scripts() { - # make sure we have $MNTPOINT available for our scripts - export MNTPOINT - if [ -d "$_opt_pre_scripts" ] || [ "$PRE_SCRIPTS" = 'yes' ] ; then - [ -d "$_opt_pre_scripts" ] && pre_scripts="$_opt_pre_scripts" || pre_scripts="$CONFFILES/pre-scripts/" - for script in ${pre_scripts}/* ; do - if [ -x "$script" ] ; then - einfo "Executing pre-script $script" - $script ; eend $? - fi - done - fi + # make sure hostname is set even before chroot-script get executed + echo "$HOSTNAME" > /etc/hostname + + # make sure we have $MNTPOINT available for our scripts + export MNTPOINT + + if [ -d "$_opt_pre_scripts" ] || [ "$PRE_SCRIPTS" = 'yes' ] ; then + [ -d "$_opt_pre_scripts" ] && pre_scripts="$_opt_pre_scripts" || pre_scripts="${CONFFILES}/pre-scripts/" + for script in "${pre_scripts}"/* ; do + if [ -x "$script" ] ; then + einfo "Executing pre-script $script" + "$script" ; eend $? + fi + done + fi } # }}} -- 2.1.4