-if [ -n "$GROOT" ] ; then
- echo "Installing grub"
-
- # copy stage-files to /boot/grub/
- [ -d /boot/grub/ ] || mkdir /boot/grub
- if [ -d /usr/lib/grub/i386-pc/ ] ; then
- cp /usr/lib/grub/i386-pc/* /boot/grub/
- else
- # sarge ships grub files in another directory
- cp /lib/grub/i386-pc/* /boot/grub/
- fi
-
- # finally install grub
- update-grub -y
- sed -i "s/^# groot=.*/# groot=(${GROOT})/g" /boot/grub/menu.lst
- # not sure why savedefault does not work for me; any ideas?
- sed -i "s/^savedefault.*/# &/g" /boot/grub/menu.lst
- update-grub -y
-
- if [ -z "$MBR" ] ; then
- echo "Notice: \$MBR not set, will not install grub therefor."
- else
- cp /proc/mounts /etc/mtab
- grub-install "$MBR"
- rm /etc/mtab
- fi
-fi
+ # listen on loopback interface only:
+ sed -i "s/^inet_interfaces = .*/inet_interfaces = loopback-only/" /etc/postfix/main.cf
+ grep -q inet_interfaces /etc/postfix/main.cf || echo 'inet_interfaces = loopback-only' >> /etc/postfix/main.cf
+ fi
+ fi
+}
+# }}}
+
+# generate initrd/initramfs {{{
+initrd() {
+ # assume the first available kernel as our main kernel
+ KERNELIMG=$(ls -1 /boot/vmlinuz-* 2>/dev/null | head -1)
+ if [ -z "$KERNELIMG" ] ; then
+ echo 'No kernel image found, skipping initrd stuff.'>&2
+ return
+ fi
+
+ KERNELVER=${KERNELIMG#/boot/vmlinuz-}
+
+ # generate initrd
+ if [ -n "$INITRD" ] ; then
+ if [ "$RELEASE" = 'sarge' ] ; then
+ echo "Release sarge detected, will not create an initrd."
+ else
+ echo "Generating initrd."
+ update-initramfs -c -t -k $KERNELVER
+ if [ -f "/boot/initrd.img-$KERNELVER" ] ; then
+ GRUBINITRD="initrd /boot/initrd.img-$KERNELVER"
+ LILOINITRD=" initrd=/boot/initrd.img-$KERNELVER"
+ fi
+ fi
+ fi
+}
+# }}}
+
+# grub configuration/installation {{{
+grub() {
+ if [ -z "$GROOT" ] ; then
+ echo "Warning: \$GROOT is not defined, will not adjust grub configuration therefore."
+ else
+ echo "Adjusting grub configuration for use on ${GROOT}."
+
+ # copy stage-files to /boot/grub/
+ [ -d /boot/grub/ ] || mkdir /boot/grub
+ # i386 specific:
+ [ -d /usr/lib/grub/i386-pc ] && cp /usr/lib/grub/i386-pc/* /boot/grub/
+ # amd64 specific:
+ [ -d /usr/lib/grub/x86_64-pc ] && cp /usr/lib/grub/x86_64-pc/* /boot/grub/
+ # sarge ships grub files in another directory
+ [ "$RELEASE" = 'sarge' ] && cp /lib/grub/i386-pc/* /boot/grub/
+
+ # finally install grub
+ if [ -x /usr/sbin/update-grub ] ; then
+ UPDATEGRUB='/usr/sbin/update-grub'
+ else
+ UPDATEGRUB='/sbin/update-grub'
+ fi
+ $UPDATEGRUB -y