From: Chih-Wei Huang Date: Thu, 8 Feb 2018 04:59:07 +0000 (+0800) Subject: Let users specify the target disk to auto install X-Git-Tag: android-x86-7.1-r2~11 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cbb58e755b572b1cb22e1d5391b05ba16f39625a;p=android-x86%2Fbootable-newinstaller.git Let users specify the target disk to auto install It's a little tricky to select ESP if auto install to non-first disk. Instead of using the ESP from the first disk, we select the ESP on the target disk. This is useful if auto install to a USB disk. --- diff --git a/boot/isolinux/isolinux.cfg b/boot/isolinux/isolinux.cfg index 8f2df61..5ebea7c 100644 --- a/boot/isolinux/isolinux.cfg +++ b/boot/isolinux/isolinux.cfg @@ -40,9 +40,9 @@ label vesa menu separator label auto_install - menu label Audo_^Installation - Auto Install to first harddisk + menu label Audo_^Installation - Auto Install to specified harddisk kernel /kernel - append initrd=/initrd.img CMDLINE AUTO_INSTALL=1 DEBUG= + append initrd=/initrd.img CMDLINE AUTO_INSTALL=0 DEBUG= label auto_update menu label Audo_^Update - Auto update Android-x86 diff --git a/install/grub2/efi/boot/android.cfg b/install/grub2/efi/boot/android.cfg index 315e228..6292e9c 100644 --- a/install/grub2/efi/boot/android.cfg +++ b/install/grub2/efi/boot/android.cfg @@ -47,7 +47,7 @@ fi submenu "Advanced options -> " { add_entry "$live - No Hardware Acceleration" quiet nomodeset HWACCEL=0 if [ -s ($android)$kdir/install.img ]; then - add_entry "Auto Install to first harddisk" AUTO_INSTALL=1 + add_entry "Auto Install to specified harddisk" AUTO_INSTALL=0 add_entry "Auto Update" AUTO_INSTALL=update fi if [ "$grub_cpu" != "i386" ]; then diff --git a/install/scripts/1-install b/install/scripts/1-install index 806b4d3..20261d9 100644 --- a/install/scripts/1-install +++ b/install/scripts/1-install @@ -1,6 +1,6 @@ # # By Chih-Wei Huang -# Last updated 2018/02/07 +# Last updated 2018/02/08 # # License: GNU Public License # We explicitely grant the right to use the scripts @@ -85,6 +85,7 @@ auto_partition() answer=`find_partition $1 $p` [ -n "$answer" ] && break done + [ -n "$efi" ] && mkdosfs -n EFI /dev/`find_partition $1 1` } partition_drive() @@ -396,22 +397,20 @@ install_to() [ -n "$efi" ] && adialog --title " Confirm " --no-label Skip --yesno \ "\n Do you want to install EFI GRUB2?" 7 39 if [ $? -eq 0 ]; then - for i in `list_disks`; do + [ -z "$AUTO_INSTALL" -o -n "$AUTO_UPDATE" ] && for i in `list_disks`; do disk=`basename $i` esp=`sgdisk --print /dev/$disk 2> /dev/null | grep EF00 | awk '{print $1}'` [ -n "$esp" ] && boot=`find_partition $disk $esp` && break done if [ -z "$esp" ]; then get_part_info $1 - boot=`basename $(blkid /dev/$disk* | grep vfat | cut -d: -f1 | head -1)` - [ -z "$boot" ] && boot=`find_partition $disk 1` + boot=$(blkid /dev/$disk* | grep vfat | cut -d: -f1 | head -1) + [ -z "$boot" ] && boot=`find_partition $disk 1` || boot=`basename $boot` esp=`cat /sys/block/$disk/$boot/partition` fi mkdir -p efi mountpoint -q efi && umount efi - while [ 1 ]; do - [ -n "$AUTO_INSTALL" -a -z "$AUTO_UPDATE" ] && mkdosfs -n EFI /dev/$boot - try_mount rw /dev/$boot efi && break + until try_mount rw /dev/$boot efi; do dialog --title " Confirm " --defaultno --yesno "\n Cannot mount /dev/$boot.\n Do you want to format it?" 8 37 [ $? -eq 0 ] && mkdosfs -n EFI /dev/$boot done