media-scan: Fix up whiptail prompt, remove errant "s for standard boot"

The whiptail prompt text was copied from the 'read' prompt but did not
actually have the Abort option.  Add it.

The "s for standard boot" option was missing from whiptail.  For plain
'read' it does not appear to revert to a normal boot, it actually went
on to try plain bootable USB on the same medium.  It's not realistic
for a disk to be both directly bootable and contain ISOs, and this
option does not appear to have been missed since it was missing from
the whiptail/fbwhiptail version, which almost all boards use.  Remove
it.

Handle canceling fbwhiptail with esc-esc the same as Abort.

Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
Jonathon Hall 2023-06-30 13:36:33 -04:00
parent 09f66e93df
commit 0378d62d49
No known key found for this signature in database
GPG Key ID: 1E9C3CA91AE25114

View File

@ -42,8 +42,10 @@ get_menu_option() {
MENU_OPTIONS="$MENU_OPTIONS $n ${option}"
done < /tmp/iso_menu.txt
MENU_OPTIONS="$MENU_OPTIONS a Abort"
whiptail $BG_COLOR_MAIN_MENU --title "Select your ISO boot option" \
--menu "Choose the ISO boot option [1-$n, s for standard boot, a to abort]:" 0 80 8 \
--menu "Choose the ISO boot option [1-$n]:" 0 80 8 \
-- $MENU_OPTIONS \
2>/tmp/whiptail || die "Aborting boot attempt"
@ -58,19 +60,15 @@ get_menu_option() {
done < /tmp/iso_menu.txt
read \
-p "Choose the ISO boot option [1-$n, s for standard boot, a to abort]: " \
-p "Choose the ISO boot option [1-$n, a to abort]: " \
option_index
fi
if [ "$option_index" = "a" ]; then
# Empty occurs when aborting fbwhiptail with esc-esc
if [ -z "$option_index" ] || [ "$option_index" = "a" ]; then
die "Aborting boot attempt"
fi
if [ "$option_index" = "s" ]; then
option=""
return
fi
option=`head -n $option_index /tmp/iso_menu.txt | tail -1`
}