You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Combine prompt to disconnect other devices with prompt to connect the
desired device.
Show block device sizes in MB/GB when selecting device so it is easier
to select. file_selector now supports --show-size to include block
device sizes in menu.
Rework file_selector so menu options can contain spaces (use bash
array) and to simplify logic.
Prompt to select flash drive and LUKS percentage in OEM reset before
actually taking any actions, so aborting doesn't half-reset the system.
Abort OEM reset if user aborts the flash drive selection instead of
looping forever. (Canceling the confirmation still loops to retry but
it is possible to exit by aborting the repeated menu.)
Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
# confirm with user size of thumb drive to be wiped
455
-
whiptail --title "Confirm thumb drive to be wiped" --yesno "Are you sure you want to wipe the following thumb drive?\n\n$FILE\n\nSize: $thumb_drive_size_message" 0 0
456
-
if [ $?-ne 0 ];then
457
-
warn "Thumb drive wipe aborted by user!"
458
-
continue
459
-
fi
460
-
461
-
#User chose and confirmed a thumb drive and its size to be wiped
462
-
thumb_drive=$FILE
422
+
# Abort if:
423
+
# - no disks found (prevent file_selector's nonsense prompt)
424
+
# - file_selector fails for any reason
425
+
# - user aborts (file_selector succeeds but FILE is empty)
426
+
if [ $(cat /tmp/usb_disk_list | wc -l)-gt 0 ] &&
427
+
file_selector --show-size "/tmp/usb_disk_list""Select USB device to partition"&&
428
+
[ -n"$FILE" ];then
429
+
# Obtain size of thumb drive to be wiped with fdisk
430
+
disk_size_bytes="$(blockdev --getsize64 "$FILE")"
431
+
if [ "$disk_size_bytes"-lt"$((128*1024*1024))" ];then
432
+
warn "Thumb drive size is less than 128MB!"
433
+
warn "LUKS container needs to be at least 8MB!"
434
+
warn "If the next operation fails, try with a bigger thumb drive"
0 commit comments