From: Michael Prokop Date: Thu, 4 Jun 2015 11:38:30 +0000 (+0200) Subject: Provide hostname to pre-scripts by setting up /etc/hostname X-Git-Tag: v0.71~17 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=bedb4090c2608ad8f9fe94e6f2b032c8f438b82c;hp=6f2677c7fe5fec2aa44856e395264959ced7a3cf 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 --- 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 } # }}}