OSDN Git Service

1-install: only format ESP if mount failed
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 9 Aug 2017 10:21:51 +0000 (18:21 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 9 Aug 2017 10:21:51 +0000 (18:21 +0800)
People may accidentally format the ESP containing Windows bootloader.
This makes Windows not bootable and unrecoverable.

To avoid such an error, only ask to format ESP if mount it failed.

install/scripts/1-install

index 6b7570d..7102346 100644 (file)
@@ -315,13 +315,9 @@ install_to()
                done
                boot=`basename $b`
                mountpoint -q /hd && umount /hd
-               dialog --title " Confirm " --defaultno --yesno \
-                       "\n Do you want to format the boot partition\n /dev/$boot?" 8 45
-               [ $? -eq 0 ] && mkdosfs -n EFI /dev/$boot
                while [ 1 ]; do
                        try_mount rw /dev/$boot /hd && break
-                       dialog --title " Confirm " --yesno \
-                       "\n Cannot mount /dev/$boot\n Do you want to format it?" 8 37
+                       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
                cp -af /grub2/efi /hd