diff options
Diffstat (limited to 'scripts/grub-setup')
-rwxr-xr-x | scripts/grub-setup | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/scripts/grub-setup b/scripts/grub-setup index b5f30647..a3ecffdf 100755 --- a/scripts/grub-setup +++ b/scripts/grub-setup @@ -27,10 +27,11 @@ # UNION="false" -while getopts u c +while getopts u: c do case $c in - u) UNION=true;; + u) UNION=true; + livedir=$OPTARG;; esac done shift `expr $OPTIND - 1` @@ -75,7 +76,7 @@ vga_logo="vga=785" # get xen kernel info xen_kernel_version=$(ls $ROOTFSDIR/boot/vmlinuz*xen 2> /dev/null | awk -F/ '{ print $5 }' | sed 's/vmlinuz//g' | sort -r) - xen_version=$(ls $ROOTFSDIR/boot/xen-* | awk -F/ '{ print $5 }' | sort -r) + xen_version=$(ls $ROOTFSDIR/boot/xen-* 2> /dev/null | awk -F/ '{ print $5 }' | sort -r) # Figure out whether we are running on the serial or KVM console: if [ "`tty`" == "/dev/ttyS0" ]; then @@ -87,7 +88,8 @@ vga_logo="vga=785" fi if eval "$UNION"; then - GRUB_OPTIONS="boot=live live-media-path=/vyatta-live module=vc4 persistent noautologin nonetworking nouser hostname=vyatta" + GRUB_OPTIONS="boot=live live-media-path=/boot/$livedir module=$livedir quiet persistent noautologin nonetworking nouser hostname=vyatta" + union_kernel_versions=$(ls $ROOTFSDIR/boot/$livedir/vmlinuz-* 2> /dev/null | grep -v xen | awk -F/ '{ print $6 }' | sed 's/vmlinuz//g' | sort -r) else # Read UUID off of filesystem and use it to tell GRUB where to mount drive # This allows device to move around and grub will still find it @@ -144,7 +146,7 @@ vga_logo="vga=785" done fi - if [ -f "$ROOTFSDIR/boot/vmlinuz" ]; then + 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 OFR (KVM console)\" {" echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $vga_logo $vty_console" @@ -160,6 +162,22 @@ vga_logo="vga=785" echo -e "}" fi + # create union kernels if they exist + if [ -n "$union_kernel_versions" ]; then + for kversion in $union_kernel_versions; do + echo + echo -e "menuentry \"Vyatta OFR 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 OFR 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 |