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
}
# }}}
# 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
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
}
# }}}
}
# }}}
+# 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
# 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 ; do
+ if stage $i ; then
$i && stage $i done || exit 1
- fi
+ fi
done
+ # always execute the finalize stage:
+ finalize
# }}}
# finally exit the chroot {{{