X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=chroot-script;h=eaf39f666fcc274941d94c8baf977065202632fe;hp=993b0a7d0432d910d4c309c728c1a25eefa00411;hb=4040ae3e3763818f6002af85aec8e9ed7c905c56;hpb=aaa4b0e3748c67c5f68a24af4ce1db79ad07a878 diff --git a/chroot-script b/chroot-script index 993b0a7..eaf39f6 100755 --- a/chroot-script +++ b/chroot-script @@ -256,7 +256,7 @@ hosts() { # set up /etc/network/interfaces {{{ interfaces() { - if ! [ -r /etc/network/interfaces ] ; then + if ! [ -r /etc/network/interfaces ] || ! grep -q "auto lo" /etc/network/interfaces ; then echo "Setting up /etc/network/interfaces" cat >> /etc/network/interfaces << EOF @@ -324,6 +324,11 @@ hostname() { if [ -n "$HOSTNAME" ] ; then echo "Setting hostname to ${HOSTNAME}." echo "$HOSTNAME" > /etc/hostname + + # adjust postfix configuration + if [ -r /etc/postfix/main.cf ] ; then + sed -i "s/grml/$HOSTNAME/g" /etc/postfix/main.cf + fi fi } # }}} @@ -388,6 +393,17 @@ grub() { } # }}} +# execute all scripts present in /etc/debootstrap/chroot-scripts/ {{{ +custom_scripts() { + [ -d /etc/debootstrap/chroot-scripts/ ] || return 0 + + for script in /etc/debootstrap/chroot-scripts/* ; do + echo "Executing script $script" + $script && echo "done" || echo "failed" + done +} +# }}} + # make sure we don't have any running processes left {{{ services() { for service in ssh mdadm mdadm-raid ; do @@ -413,10 +429,11 @@ 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 services finalize ; do - if stage $i ; then + timezone fstab hostname initrd grub passwords custom_scripts \ + services finalize ; do + if stage $i ; then $i && stage $i done || exit 1 - fi + fi done # }}}