[PATCH] Do not add boot options to bootloader that are unavailable
Hello,
Following my patch to add the ability to disable the use of the GTK graphical d-i installer, I've created this patch which modifies lh_binary_grub, lh_binary_syslinux, and lh_binary_yaboot to not add the boot options for unavailable frontends by checking to ensure the kernel and initrd files for the frontend exist.
As a part of this change, I updated lh_binary_grub and lh_binary_yaboot to create their entries in the same fashion lh_binary_syslinux does (see patch for details). I've tested a build with syslinux but have not tested yaboot or grub. I'll see about doing a test build with both of these bootloaders today if no one else takes the initiative and does so first.
lh_binary_grub | 59 ++++++++++++++++++++++++++++++++++++++----------
lh_binary_syslinux | 11 +++++++--
lh_binary_yaboot | 64 ++++++++++++++++++++++++++++++++++++++---------------
3 files changed, 102 insertions(+), 32 deletions(-)
As a side note, after looking at these scripts it looks like there is a lot of potential to reduce some code duplication and have a more standard experience between the three bootloaders. I'll see about tackling this in the near future.
Cheers,
--
Cody A.W. Somerville
Software Systems Release Engineer
Foundations Team
Custom Engineering Solutions Group
Canonical OEM Services
Phone: +1-781-850-2087
Cell: +1-506-471-8402
Email: cody.somerville@canonical.com
=== modified file 'helpers/lh_binary_syslinux'
--- helpers/lh_binary_syslinux 2009-06-08 05:36:05 +0000
+++ helpers/lh_binary_syslinux 2009-08-28 08:50:50 +0000
@@ -548,8 +548,15 @@
INITRD_GI="gtk/initrd.gz"
APPEND_GI="video=vesa:ywrap,mtrr vga=788"
- Syslinux_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
- Syslinux_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
+ if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_DI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_DI}" ]
+ then
+ Syslinux_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
+ fi
+
+ if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_GI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_GI}" ]
+ then
+ Syslinux_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
+ fi
fi
# Assembling memtest configuration
=== modified file 'helpers/lh_binary_grub'
--- helpers/lh_binary_grub 2009-04-17 08:23:38 +0000
+++ helpers/lh_binary_grub 2009-08-28 09:48:01 +0000
@@ -78,14 +78,46 @@
INITRD="${3}"
APPEND="${4}"
- if [ "${LH_DISTRIBUTION}" != "etch" ] && [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ]
+ # Boot in quiet mode where appropriate
+ if [ "${LH_DISTRIBUTION}" != "etch" ]
then
- APPEND="${APPEND} quiet"
+ QAPPEND="quiet"
fi
- LINUX_INSTALL="${LINUX_INSTALL}\ntitle\t\tDebian GNU/Linux - ${LABEL}"
- LINUX_INSTALL="${LINUX_INSTALL}\nkernel\t\t/${KERNEL} ${APPEND} LH_BOOTAPPEND_INSTALL"
- LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}"
+ for TYPE in Install Expert Rescue Auto
+ do
+ case "${TYPE}" in
+ Install)
+ TAPPEND="${APPEND} ${QAPPEND}"
+ ;;
+
+ Expert)
+ TAPPEND="priority=low ${APPEND}"
+ ;;
+
+ Rescue)
+ TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}"
+ ;;
+
+ Auto)
+ TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}"
+ ;;
+ esac
+
+ case "${LABEL}" in
+ Text)
+ TYPE_SUFFIX=""
+ ;;
+ GUI)
+ TYPE_SUFFIX="gui"
+ ;;
+ esac
+
+
+ LINUX_INSTALL="${LINUX_INSTALL}\ntitle\t\t${LABEL} ${TYPE}"
+ LINUX_INSTALL="${LINUX_INSTALL}\nkernel\t\t/${KERNEL} ${TAPPEND} ${LH_BOOTAPPEND_INSTALL}"
+ LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}"
+ done
}
case "${LH_INITRAMFS}" in
@@ -222,14 +254,15 @@
INITRD_GI="install/gtk/initrd.gz"
APPEND_GI="video=vesa:ywrap,mtrr vga=788"
- Grub_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
- Grub_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
- Grub_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}"
- Grub_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}"
- Grub_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}"
- Grub_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}"
- Grub_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}"
- Grub_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}"
+ if [ -f "binary/boot/${VMLINUZ_DI}" ] && [ -f "binary/boot/${INITRD_DI}" ]
+ then
+ Grub_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
+ fi
+
+ if [ -f "binary/boot/${VMLINUZ_GI}" ] && [ -f "binary/boot/${INITRD_GI}" ]
+ then
+ Grub_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
+ fi
fi
LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')"
=== modified file 'helpers/lh_binary_yaboot'
--- helpers/lh_binary_yaboot 2009-01-26 16:39:27 +0000
+++ helpers/lh_binary_yaboot 2009-08-28 09:39:32 +0000
@@ -84,16 +84,46 @@
DIRECTORY="/$(basename ${DESTDIR_INSTALL})"
- if [ "${LH_DISTRIBUTION}" != "etch" ] && [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ]
+ if [ "${LH_DISTRIBUTION}" != "etch" ]
then
- APPEND="${APPEND} quiet"
+ QAPPEND="quiet"
fi
-
- LINUX_INSTALL="${LINUX_INSTALL}\nimage=${DIRECTORY}/${KERNEL}\n"
- LINUX_INSTALL="${LINUX_INSTALL}\tlabel=${LABEL}\n"
- LINUX_INSTALL="${LINUX_INSTALL}\tinitrd=${DIRECTORY}/${INITRD}\n"
- LINUX_INSTALL="${LINUX_INSTALL}\tappend=\"LH_BOOTAPPEND_LIVE ${APPEND} LH_BOOTAPPEND_INSTALL\"\n"
- LINUX_INSTALL="${LINUX_INSTALL}\tinitrd-size=10240\n"
+
+ for TYPE in Install Expert Rescue Auto
+ do
+ case "${TYPE}" in
+ Install)
+ TAPPEND="${APPEND} ${QAPPEND}"
+ ;;
+
+ Expert)
+ TAPPEND="priority=low ${APPEND}"
+ ;;
+
+ Rescue)
+ TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}"
+ ;;
+
+ Auto)
+ TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}"
+ ;;
+ esac
+
+ case "${LABEL}" in
+ Text)
+ TYPE_SUFFIX=""
+ ;;
+ GUI)
+ TYPE_SUFFIX="gui"
+ ;;
+ esac
+
+ LINUX_INSTALL="${LINUX_INSTALL}\nimage=${DIRECTORY}/${KERNEL}\n"
+ LINUX_INSTALL="${LINUX_INSTALL}\tlabel=${TYPE}${TYPE_SUFFIX}\n"
+ LINUX_INSTALL="${LINUX_INSTALL}\tinitrd=${DIRECTORY}/${INITRD}\n"
+ LINUX_INSTALL="${LINUX_INSTALL}\tappend=\"${TAPPEND} ${LH_BOOTAPPEND_INSTALL}\"\n"
+ LINUX_INSTALL="${LINUX_INSTALL}\tinitrd-size=10240\n"
+ done
}
case "${LH_INITRAMFS}" in
@@ -231,15 +261,15 @@
INITRD_GI="gtk/initrd.gz"
APPEND_GI="video=vesa:ywrap,mtrr vga=788"
- Yaboot_install_entry "linux" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
- Yaboot_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
- Yaboot_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
- Yaboot_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}"
- Yaboot_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}"
- Yaboot_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}"
- Yaboot_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}"
- Yaboot_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}"
- Yaboot_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}"
+ if [ -f "binary/${DESTDIR_INSTALL}/${VMLINUZ_DI}" ] && [ -f "binary/${DESTDIR_INSTALL}/${INITRD_DI}" ]
+ then
+ Yaboot_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
+ fi
+
+ if [ -f "binary/${DESTDIR_INSTALL}/${VMLINUZ_GI}" ] && [ -f "binary/${DESTDIR_INSTALL}/${INITRD_GI}" ]
+ then
+ Yaboot_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
+ fi
fi
LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')"
Reply to: