}
+#
+# Generate a Debian-/Ubuntu-compliant menu.lst for legacy GRUB
+#
+generateDebianGrubMenuLst ()
+{
+ prefix="$1"
+ DOMU_ISSUE="$2"
+ DOMU_KERNEL="$3"
+ DOMU_RAMDISK="$4"
+
+ #
+ # Log our options
+ #
+ logMessage "Generating a legacy GRUB menu.lst into prefix ${prefix}"
+
+ #
+ # We require at least 3 parameters
+ #
+ assert "$LINENO" "${prefix}"
+ assert "$LINENO" "${DOMU_ISSUE}"
+ assert "$LINENO" "${DOMU_KERNEL}"
+
+ #
+ # Prefix must be a directory, kernel a file
+ #
+ assert "$LINENO" -d ${prefix}
+ assert "$LINENO" -f "${prefix}/boot/${DOMU_KERNEL}"
+
+ #
+ # Generate a menu.lst for pygrub
+ #
+
+ mkdir -p ${prefix}/boot/grub
+ cat << E_O_MENU > ${prefix}/boot/grub/menu.lst
+default 0
+timeout 2
+
+### BEGIN AUTOMAGIC KERNELS LIST
+## lines between the AUTOMAGIC KERNELS LIST markers will be modified
+## by the debian update-grub script except for the default options below
+
+## DO NOT UNCOMMENT THEM, Just edit them to your needs
+
+## ## Start Default Options ##
+## default kernel options
+## default kernel options for automagic boot options
+## If you want special options for specific kernels use kopt_x_y_z
+## where x.y.z is kernel version. Minor versions can be omitted.
+## e.g. kopt=root=/dev/hda1 ro
+## kopt_2_6_8=root=/dev/hdc1 ro
+## kopt_2_6_8_2_686=root=/dev/hdc2 ro
+# kopt=root=/dev/xvda2 ro elevator=noop
+
+## default grub root device
+## e.g. groot=(hd0,0)
+# groot=(hd0,0)
+
+## should update-grub create alternative automagic boot options
+## e.g. alternative=true
+## alternative=false
+# alternative=true
+
+## should update-grub lock alternative automagic boot options
+## e.g. lockalternative=true
+## lockalternative=false
+# lockalternative=false
+
+## additional options to use with the default boot option, but not with the
+## alternatives
+## e.g. defoptions=vga=791 resume=/dev/hda5
+# defoptions=
+
+## should update-grub lock old automagic boot options
+## e.g. lockold=false
+## lockold=true
+# lockold=false
+
+## altoption boot targets option
+## multiple altoptions lines are allowed
+## e.g. altoptions=(extra menu suffix) extra boot options
+## altoptions=(single-user) single
+# altoptions=(single-user mode) single
+
+## controls how many kernels should be put into the menu.lst
+## only counts the first occurence of a kernel, not the
+## alternative kernel options
+## e.g. howmany=all
+## howmany=7
+# howmany=all
+
+## should update-grub create memtest86 boot option
+## e.g. memtest86=true
+## memtest86=false
+# memtest86=false
+
+## should update-grub adjust the value of the default booted system
+## can be true or false
+# updatedefaultentry=false
+
+## should update-grub add savedefault to the default options
+## can be true or false
+# savedefault=false
+
+## ## End Default Options ##
+
+### END DEBIAN AUTOMAGIC KERNELS LIST
+
+# Entries statically generated bu xen-tools upon installation. Maybe
+# removed manually if the entries above (generated by update-grub)
+# seem to work fine.
+
+title $DOMU_ISSUE
+root (hd0,0)
+kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro elevator=noop
+initrd /boot/$DOMU_RAMDISK
+
+title $DOMU_ISSUE (Single-User)
+root (hd0,0)
+kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single elevator=noop
+initrd /boot/$DOMU_RAMDISK
+
+title $DOMU_ISSUE (Default Kernel)
+root (hd0,0)
+kernel /vmlinuz root=/dev/xvda2 ro elevator=noop
+initrd /initrd.img
+
+title $DOMU_ISSUE (Default Kernel, Single-User)
+root (hd0,0)
+kernel /vmlinuz root=/dev/xvda2 ro single elevator=noop
+initrd /initrd.img
+
+E_O_MENU
+
+
+}
+
+
#
# Disable the start-stop-daemon
DOMU_RAMDISK=$(basename $(ls -1 ${prefix}/boot/initrd*|tail -n 1))
DOMU_ISSUE=$(head -n 1 ${prefix}/etc/issue | awk -F '\' '{ print $1 }' | sed 's/[ \t]*$//')
-mkdir -p ${prefix}/boot/grub
-cat << E_O_MENU > ${prefix}/boot/grub/menu.lst
-default 0
-timeout 2
-
-title $DOMU_ISSUE
-root (hd0,0)
-kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro elevator=noop
-initrd /boot/$DOMU_RAMDISK
-
-title $DOMU_ISSUE (Single-User)
-root (hd0,0)
-kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single elevator=noop
-initrd /boot/$DOMU_RAMDISK
-
-E_O_MENU
+#
+# Generate a menu.lst for pygrub
+#
+
+generateDebianGrubMenuLst "${prefix}" "$DOMU_ISSUE" "$DOMU_KERNEL" "$DOMU_RAMDISK"
+
else
logMessage "Package '${linux_kernel_package}' is not available"