OSDN Git Service

1-install: check which grub should be installed
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 30 Sep 2016 02:50:19 +0000 (10:50 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 30 Sep 2016 02:50:19 +0000 (10:50 +0800)
Originally we ask whether to install both legacy grub and efi grub.
This may confuse the users.

The patch checks if the device is EFI enabled and ask to install
the appropriate grub only.

install/scripts/1-install

index acb54cd..2f1d6cf 100644 (file)
@@ -285,7 +285,8 @@ install_to()
        cmdline=`sed "s|\(initrd.*img\s*\)||; s|quiet\s*||; s|\(vga=\w\+\?\s*\)||; s|\(DPI=\w\+\?\s*\)||; s|\(INSTALL=\w\+\?\s*\)||; s|\(SRC=\S\+\?\s*\)||; s|\(DEBUG=\w\+\?\s*\)||; s|\(BOOT_IMAGE=\S\+\?\s*\)||; s|\(iso-scan/filename=\S\+\?\s*\)||;" /proc/cmdline`
 
        asrc=android-$VER
-       dialog --title " Confirm " --no-label Skip --defaultno --yesno \
+       efi="`dmesg | grep EFI.VGA`"
+       [ -z "$efi" ] && dialog --title " Confirm " --no-label Skip --defaultno --yesno \
                "\n Do you want to install boot loader GRUB?" 7 47
        if [ $? -eq 0 ]; then
                cp -af /grub /hd
@@ -299,7 +300,7 @@ install_to()
                [ $? -ne 0 ] && return 255
        fi
 
-       dialog --title " Confirm " --no-label Skip --defaultno --yesno \
+       [ -n "$efi" ] && dialog --title " Confirm " --no-label Skip --defaultno --yesno \
                "\n Do you want to install EFI GRUB2?" 7 39
        if [ $? -eq 0 ]; then
                get_part_info $1