summaryrefslogtreecommitdiff
path: root/scripts/vyatta-grub-setup
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2010-07-19 17:41:09 -0700
committerBob Gilligan <gilligan@vyatta.com>2010-07-19 17:41:09 -0700
commit79f673e0634f4857632e9dad6c4c6301a67b61d8 (patch)
treee1114744872d9f1fc4c24b10a0e872d40a44d9dc /scripts/vyatta-grub-setup
parentb3aef2e0a16a04f1c97609142784e4681b5e7087 (diff)
downloadvyatta-cfg-quagga-79f673e0634f4857632e9dad6c4c6301a67b61d8.tar.gz
vyatta-cfg-quagga-79f673e0634f4857632e9dad6c4c6301a67b61d8.zip
Bugfix 5512: Have grub.cfg use the vmlinuz and initrd.img symlinks if available
The /boot directory is populated with vmlinuz and initrd.img files whose names are suffixed with the kernel version string. A vmlinuz and initrd.img symlink points to the "current" version of each file. It is simpler to have the grub.cfg file use the symlink, since then the kernel to boot can be changed by just adjusting the symlinks.
Diffstat (limited to 'scripts/vyatta-grub-setup')
-rwxr-xr-xscripts/vyatta-grub-setup112
1 files changed, 67 insertions, 45 deletions
diff --git a/scripts/vyatta-grub-setup b/scripts/vyatta-grub-setup
index 83a1c1f9..0c83ff4d 100755
--- a/scripts/vyatta-grub-setup
+++ b/scripts/vyatta-grub-setup
@@ -26,6 +26,15 @@
#
#
+#
+# Usage:
+#
+# vyatta-grub-setup [ -u <livedir> ] [ -v <version> ]
+#
+# The -u and -v flags are mutually exclusive.
+#
+
+
# The OS version we are installing
version=""
@@ -206,52 +215,65 @@ fi
done
fi
- if [ -f "$ROOTFSDIR/boot/vmlinuz" ] && ! eval $UNION ; then
- # Set first system boot option. Make KVM the default console in this one.
- echo -e "menuentry \"Vyatta $version (KVM console)\" {"
- echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $VGA_LOGO $vty_console"
- echo -e "\tinitrd /boot/initrd.img"
- echo -e "}"
-
- # Set the second system boot option. Make the serial port be the default
- # console in this one.
- echo
- echo -e "menuentry \"Vyatta $version (Serial console)\" {"
- echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $serial_console"
- echo -e "\tinitrd /boot/initrd.img"
- echo -e "}"
- fi
+ if eval "$UNION"; then
+ # UNION case
+ if [ -e "$ROOTFSDIR/boot/$livedir/vmlinuz" -a \
+ -e "$ROOTFSDIR/boot/$livedir/initrd.img" ]; then
+ echo
+ echo -e "menuentry \"Vyatta $version linux (KVM console)\" {"
+ echo -e "\tlinux /boot/$livedir/vmlinuz $GRUB_OPTIONS $VGA_LOGO $vty_console"
+ echo -e "\tinitrd /boot/$livedir/initrd.img"
+ echo -e "}"
+ echo
+ echo -e "menuentry \"Vyatta $version linux (Serial console)\" {"
+ echo -e "\tlinux /boot/$livedir/vmlinuz $GRUB_OPTIONS $serial_console"
+ echo -e "\tinitrd /boot/$livedir/initrd.img"
+ echo -e "}"
+
+ elif [ -n "$union_kernel_versions" ]; then
+ for kversion in $union_kernel_versions; do
+ echo
+ echo -e "menuentry \"Vyatta $version linux$kversion (KVM console)\" {"
+ echo -e "\tlinux /boot/$livedir/vmlinuz$kversion $GRUB_OPTIONS $VGA_LOGO $vty_console"
+ echo -e "\tinitrd /boot/$livedir/initrd.img$kversion"
+ echo -e "}"
+ echo
+ echo -e "menuentry \"Vyatta $version linux$kversion (Serial console)\" {"
+ echo -e "\tlinux /boot/$livedir/vmlinuz$kversion $GRUB_OPTIONS $serial_console"
+ echo -e "\tinitrd /boot/$livedir/initrd.img$kversion"
+ echo -e "}"
+ done
+ fi
+ else
+ # Non-UNION case
+ if [ -f "$ROOTFSDIR/boot/vmlinuz" ]; then
+ # Set first system boot option. Make KVM the default console in this one.
+ echo -e "menuentry \"Vyatta $version (KVM console)\" {"
+ echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $VGA_LOGO $vty_console"
+ echo -e "\tinitrd /boot/initrd.img"
+ echo -e "}"
- # create union kernels if they exist
- if [ -n "$union_kernel_versions" ]; then
- for kversion in $union_kernel_versions; do
- echo
- echo -e "menuentry \"Vyatta $version linux$kversion (KVM console)\" {"
- echo -e "\tlinux /boot/$livedir/vmlinuz$kversion $GRUB_OPTIONS $VGA_LOGO $vty_console"
- echo -e "\tinitrd /boot/$livedir/initrd.img$kversion"
- echo -e "}"
- echo
- echo -e "menuentry \"Vyatta $version linux$kversion (Serial console)\" {"
- echo -e "\tlinux /boot/$livedir/vmlinuz$kversion $GRUB_OPTIONS $serial_console"
- echo -e "\tinitrd /boot/$livedir/initrd.img$kversion"
- echo -e "}"
- done
- fi
-
- # create other kernels if they exist
- if [ -n "$kernel_versions" ]; then
- for kversion in $kernel_versions; do
- echo
- echo -e "menuentry \"Vyatta $version linux$kversion (KVM console)\" {"
- echo -e "\tlinux /boot/vmlinuz$kversion $GRUB_OPTIONS $VGA_LOGO $vty_console"
- echo -e "\tinitrd /boot/initrd.img$kversion"
- echo -e "}"
- echo
- echo -e "menuentry \"Vyatta $version linux$kversion (Serial console)\" {"
- echo -e "\tlinux /boot/vmlinuz$kversion $GRUB_OPTIONS $serial_console"
- echo -e "\tinitrd /boot/initrd.img$kversion"
- echo -e "}"
- done
+ # Set the second system boot option. Make the serial port be the default
+ # console in this one.
+ echo
+ echo -e "menuentry \"Vyatta $version (Serial console)\" {"
+ echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $serial_console"
+ echo -e "\tinitrd /boot/initrd.img"
+ echo -e "}"
+ elif [ -n "$kernel_versions" ]; then
+ for kversion in $kernel_versions; do
+ echo
+ echo -e "menuentry \"Vyatta $version linux$kversion (KVM console)\" {"
+ echo -e "\tlinux /boot/vmlinuz$kversion $GRUB_OPTIONS $VGA_LOGO $vty_console"
+ echo -e "\tinitrd /boot/initrd.img$kversion"
+ echo -e "}"
+ echo
+ echo -e "menuentry \"Vyatta $version linux$kversion (Serial console)\" {"
+ echo -e "\tlinux /boot/vmlinuz$kversion $GRUB_OPTIONS $serial_console"
+ echo -e "\tinitrd /boot/initrd.img$kversion"
+ echo -e "}"
+ done
+ fi
fi
# Set options for root password reset. Offer