--- /dev/null
+#!/bin/sh -e
+
+PREREQS=""
+
+prereqs()
+{
+ echo "$PREREQS"
+}
+
+case "$1" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+do_install()
+{
+ echo
+ echo
+ echo "Triggering installer!"
+ ROOT_SRC=$(grep ' /root ' /proc/mounts | cut -d' ' -f1)
+ ROOT_SRC=$(readlink -f $ROOT_SRC)
+
+ echo "root src: $ROOT_SRC"
+ [ -d /root/etc ] || {
+ echo "Error: /root doesn't appear to have a valid filesystem mounted!"
+ exit 1
+ }
+
+}
+
+for x in $(cat /proc/cmdline); do
+ case $x in
+ installer)
+ do_install
+ ;;
+ esac
+done
+
# set the default locale
echo "${IMG_LOCALE}" >${ROOT_DIR}/etc/locale.gen
+# add support for installation onto a block device
+mkdir -p ${ROOT_DIR}/etc/initramfs-tools/scripts/local-bottom
+cp installer ${ROOT_DIR}/etc/initramfs-tools/scripts/local-bottom/
+
# run any customizations necessary pre-package install
customize_chroot_hook "$ROOT_DIR"
timeout 5
color cyan/blue white/blue
EOF
+ installer_added=0
label=`sed -ne 's/^LABEL=\(.\+\)[[:space:]]\+\/[[:space:]]\+.*/\1/p' configs/${CONFIG_TYPE}/fstab-ext3`
prefix=
grep -q ' ${mntpt}/boot ' /proc/mounts && prefix=/boot
initrd ${prefix}/initrd.img-${v}
boot
EOF
+ if [ "$installer_added" = "0" ]; then
+ installer_added=1
+ cat >>${mntpt}/boot/grub/menu.lst<<EOF
+
+title Debian GNU/Linux Installer
+root (hd0,0)
+kernel ${prefix}/vmlinuz-${v} root=LABEL=${label} ro installer
+initrd ${prefix}/initrd.img-${v}
+boot
+EOF
+ fi
+
done
# grub-install is pretty broken, so we do this manually