From: Heiko Z. <smi...@us...> - 2011-12-18 21:27:26
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory vz-cvs-3.sog:/tmp/cvs-serv21683 Modified Files: install-on-usb Log Message: partial support for the new grub 1.99 Index: install-on-usb =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/install-on-usb,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- install-on-usb 6 Dec 2011 09:13:03 -0000 1.36 +++ install-on-usb 18 Dec 2011 21:27:24 -0000 1.37 @@ -123,28 +123,26 @@ install_grub () { echo "Configuring Grub boot sector and menu..." - if [ -f "/DEVIL-LINUX" ]; then # we are in DL - grub_shell=$TMPDIR/iso-mnt/sbin/grub - else - grub_shell=$(which grub) + GRUBVERSION=0 + grub_shell=$(which grub 2> /dev/null) + if [ -n "$grub_shell" ]; then + GRUBVERSION=1 if $grub_shell --version | grep "GNU GRUB 0.9" > /dev/null 2>&1 ; then echo "Using $grub_shell binary..." else echo "Probably unsupported Grub version. If the installation breaks, load DL as Live-CD and repeat installation" fi fi + + if [ -n "$(grub-install -v | grep "1.9")" ]; then + GRUBVERSION=2 + fi + device_map=grub-tmp-map force_lba="" if [ "$INITRD_TYPE" != "INITRAMFS" ]; then KERNEL_OPTIONS="root=/dev/ram0 init=/linuxrc $RAMDISK" fi - - if [ ! -f "$grub_shell" ]; then - echo "Grub not found in ISO image - was it included in the DL build?" - umount $TMPDIR/iso-mnt #|| exit 1 - umount $TMPDIR/disk-mnt #|| exit 1 - exit 1 - fi rm -f $device_map @@ -224,19 +222,30 @@ ln -s grub.conf menu.lst popd > /dev/null - $grub_shell --batch --device-map=$device_map <<-EOF > /dev/null - quit - EOF + case "$GRUBVERSION" in + "1" ) + $grub_shell --batch --device-map=$device_map <<-EOF > /dev/null + quit + EOF - install_drive=$(grep "$1\$" $device_map|cut -f1) - root_drive="${install_drive%%)},0)" + install_drive=$(grep "$1\$" $device_map|cut -f1) + root_drive="${install_drive%%)},0)" - $grub_shell --batch --device-map=$device_map <<-EOF > /dev/null - root $root_drive - setup $force_lba $install_drive - quit - EOF - rm -f $device_map + $grub_shell --batch --device-map=$device_map <<-EOF > /dev/null + root $root_drive + setup $force_lba $install_drive + quit + EOF + rm -f $device_map + ;; + "2" ) + set -x + grub-install --boot-directory=$TMPDIR/disk-mnt/boot $1 + ;; + * ) + echo "No clue which GRUB version you're using, aborting" + ;; + esac } install_dl () |