From c095fa715a6fae2f6b36a8a27ad24e9f24788f5b Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Tue, 20 Nov 2007 17:05:34 -0800 Subject: Bugfix: 2412 Provide boot options in menu.lst for both Serial and KVM consoles. In both options, set up the other console to serve as the secondary console. Select which boot option to use by default based on the tty that the user is running install-system on. --- scripts/install-system.in | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'scripts/install-system.in') diff --git a/scripts/install-system.in b/scripts/install-system.in index 325f7980..90a142b7 100755 --- a/scripts/install-system.in +++ b/scripts/install-system.in @@ -588,21 +588,48 @@ install_grub () { root="(hd0,$part)" fi + # Figure out whether we are running on the serial or KVM console: + if [ "`tty`" == "/dev/ttyS0" ]; then + # Since user is running on serial console, make that the default. + DEFAULT_CONSOLE="1" + else + # Since user is running on KVM console, make that the default + DEFAULT_CONSOLE="0" + fi + # create the menu.lst file for grub + # The "default=" line selects which boot option will be used by default. + # Numbering starts at 0 for the first option. grub_file="$rootfsdir/boot/grub/menu.lst" - echo -e "default=0\ntimeout=5\n#splashimage=(hd0,0)/grub/splash.xpm.gz\nhiddenmenu" > $grub_file + echo -e "default=$DEFAULT_CONSOLE\ntimeout=5\n#splashimage=(hd0,0)/grub/splash.xpm.gz\nhiddenmenu" > $grub_file # set serial console options echo -e "serial --unit=0 --speed=9600\nterminal --timeout=5 console serial\n\n" >> $grub_file - # set primary boot option - echo -e "title Vyatta OFR\n\troot $root" >> $grub_file + + # Set first system boot option. Make KVM the default console in this one. + echo -e "title Vyatta OFR (KVM console)\n\troot $root" >> $grub_file echo -en "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 \n" >> $grub_file echo -e "\tinitrd /boot/initrd.img" >> $grub_file - # Set root password reset option + # Set the second system boot option. Make the serial port be the default + # console in this one. + echo >> $grub_file + echo -e "title Vyatta OFR (Serial console)\n\troot $root" >> $grub_file + echo -en "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 \n" >> $grub_file + echo -e "\tinitrd /boot/initrd.img" >> $grub_file + + # Set third and fourth boot options for root password reset. Offer + # options for both serial and KVM console. + + echo >> $grub_file + echo -e "title Root password reset to factory (KVM console)" >> $grub_file + echo -e "\troot $root" >> $grub_file + echo -e "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 init=$PWRESET" >> $grub_file + echo -e "\tinitrd /boot/initrd.img" >> $grub_file + echo >> $grub_file - echo -e "title Root password reset to factory (serial console)" >> $grub_file + echo -e "title Root password reset to factory (Serial console)" >> $grub_file echo -e "\troot $root" >> $grub_file - echo -e "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 init=$PWRESET" >> $grub_file + echo -e "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 init=$PWRESET" >> $grub_file echo -e "\tinitrd /boot/initrd.img" >> $grub_file echo "OK" -- cgit v1.2.3