diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install-system | 87 |
1 files changed, 72 insertions, 15 deletions
diff --git a/scripts/install-system b/scripts/install-system index 56803420..eb72eaa5 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -566,6 +566,13 @@ install_grub () { echo "This looks like a removable device. Setting root grub device to $root." >> $INSTALL_LOG fi + # get list of kernels, except xen + kernel_versions=$(ls /boot/vmlinuz-* | grep -v xen | sed 's:/boot/vmlinuz::g' | sort -r) + + # get xen kernel info + xen_kernel_version=$(ls /boot/vmlinuz*xen | sed 's:/boot/vmlinuz::g' | sort -r) + xen_version=$(ls /boot/ | grep xen- | sort -r) + # 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. @@ -587,24 +594,54 @@ install_grub () { echo -e "serial --unit=0 --speed=9600" echo "terminal --timeout=5 console serial" echo "set root=$root" - echo - echo + if [ -f "/boot/vmlinuz" ]; then + echo -e "set default=$DEFAULT_CONSOLE\n\n\n" - # Set first system boot option. Make KVM the default console in this one. - echo -e "menuentry \"Vyatta OFR (KVM console)\" {" - echo -en "\tlinux /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 \n" - echo -e "\tinitrd /boot/initrd.img" - echo -e "}" + # Set first system boot option. Make KVM the default console in this one. + echo -e "menuentry \"Vyatta OFR (KVM console)\" {" + echo -en "\tlinux /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 \n" + 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 OFR (Serial console)\" {" - echo -en "\tlinux /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 \n" - 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 OFR (Serial console)\" {" + echo -en "\tlinux /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 \n" + echo -e "\tinitrd /boot/initrd.img" + echo -e "}" + fi - # Set third and fourth boot options for root password reset. Offer + # create xen kernels if they exist + if [ -n "$xen_kernel_version" ]; then + for xversion in $xen_kernel_version; do + echo + echo + echo -e "menuentry \"Vyatta Xen linux$xversion dom0\" {" + echo -e "\tmultiboot /boot/$xen_version " + echo -en "\tmodule /boot/vmlinuz$xversion root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 \n" + echo -e "\tmodule /boot/initrd.img$xversion" + 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 OFR linux$kversion (KVM console)\" {" + echo -en "\tlinux /boot/vmlinuz$kversion root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 \n" + echo -e "\tinitrd /boot/initrd.img$kversion" + echo -e "}" + echo + echo -e "menuentry \"Vyatta OFR linux$kversion (Serial console)\" {" + echo -en "\tlinux /boot/vmlinuz$kversion root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 \n" + echo -e "\tinitrd /boot/initrd.img$kversion" + echo -e "}" + done + fi + + # Set options for root password reset. Offer # options for both serial and KVM console. echo @@ -781,6 +818,23 @@ unmount () { fi } +setup_xen_partition_images () { + if [ ! -f "$rootfsdir/var/xen/router.img.gz.orig" ]; then + cp $rootfsdir/var/xen/router.img.gz $rootfsdir/var/xen/router.img.gz.orig + fi + if [ ! -f "$rootfsdir/var/xen/asterisk-0.9.6.5-x86.img.gz.orig" ]; then + cp $rootfsdir/var/xen/asterisk-0.9.6.5-x86.img.gz $rootfsdir/var/xen/asterisk.img.gz.orig + fi + if [ ! -f "$rootfsdir/var/xen/router.img" ]; then + echo I: decompressing router.img + gzip -d $rootfsdir/var/xen/router.img.gz + fi + if [ ! -f "$rootfsdir/var/xen/asterisk.img" ]; then + echo I: decompressing asterisk.img + gzip -d $rootfsdir/var/xen/asterisk-0.9.6.5-x86.img.gz + fi +} + progress_indicator () { case "$1" in start) $vyatta_bindir/progress-indicator $SPID & @@ -875,6 +929,9 @@ install_root_filesystem "$ROOT_PARTITION" # Copy the config files copy_config "$CONFIG_PARTITION" +# check for xen part images in /var/xen +setup_xen_partition_images + # Install grub install_grub |