X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=chroot-script;h=072fb4c048a968e23e560d317049ed6b3e735358;hp=eaf39f666fcc274941d94c8baf977065202632fe;hb=420ac27e61ea1add01319a4f666bd8fb9dc72bd1;hpb=0bb99ec2af1e4383ed819715481257b2ca77d5cd diff --git a/chroot-script b/chroot-script index eaf39f6..072fb4c 100755 --- a/chroot-script +++ b/chroot-script @@ -36,9 +36,11 @@ stage() { echo "$2" > "$STAGES/$1" return 0 elif grep -q done "$STAGES/$1" 2>/dev/null ; then - echo "[*] Notice: stage $1 has been executed already, skipping execution therefore.">&2 + echo " [*] Notice: stage $1 has been executed already, skipping execution therefore.">&2 return 1 fi + echo " Executing stage ${1}" + return 0 } # }}} @@ -251,6 +253,10 @@ hosts() { echo "Setting up /etc/hosts" echo "127.0.0.1 localhost $HOSTNAME" > /etc/hosts fi + + if [ -n "$HOSTNAME" ] ; then + sed -i "s/grml/$HOSTNAME/g" /etc/hosts + fi } # }}} @@ -327,7 +333,14 @@ hostname() { # adjust postfix configuration if [ -r /etc/postfix/main.cf ] ; then + # adjust hostname related options: sed -i "s/grml/$HOSTNAME/g" /etc/postfix/main.cf + sed -i "s/^myhostname = .*/myhostname = $HOSTNAME/" /etc/postfix/main.cf + sed -i "s/^mydestination = .*/mydestination = localdomain, localhost, localhost.localdomain, $HOSTNAME/" /etc/postfix/main.cf + + # listen on loopback interface only: + sed -i "s/^inet_interfaces = .*/inet_interfaces = loopback-only/" /etc/postfix/main.cf + grep inet_interfaces /etc/postfix/main.cf || echo 'inet_interfaces = loopback-only' >> /etc/postfix/main.cf fi fi } @@ -429,12 +442,13 @@ finalize() { # execute the functions {{{ for i in chrootmirror grmlrepos kernelimg_conf makedev install_policy_rcd \ packages extrapackages mkinitrd kernel reconfigure hosts interfaces \ - timezone fstab hostname initrd grub passwords custom_scripts \ - services finalize ; do + timezone fstab hostname initrd grub passwords custom_scripts services ; do if stage $i ; then $i && stage $i done || exit 1 fi done + # always execute the finalize stage: + finalize # }}} # finally exit the chroot {{{