From 7769d139967b2221db051c08a0e482d0d3418044 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 15 Mar 2022 12:00:20 -0500 Subject: [PATCH 1/4] kexec-select-boot: Simplify boot menu entries Drop the duplicated kernel info which hurts readability, runs off the end of the menu window. This also makes it easier to identify which menu option is the default, and more closely resembles the grub menu shown in a traditional BIOS boot. Signed-off-by: Matt DeVillier --- initrd/bin/kexec-select-boot | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/initrd/bin/kexec-select-boot b/initrd/bin/kexec-select-boot index a58cc218..cc03920b 100755 --- a/initrd/bin/kexec-select-boot +++ b/initrd/bin/kexec-select-boot @@ -99,8 +99,7 @@ get_menu_option() { parse_option n=`expr $n + 1` name=$(echo $name | tr " " "_") - kernel=$(echo $kernel | cut -f2 -d " ") - MENU_OPTIONS="$MENU_OPTIONS $n ${name}_[$kernel]" + MENU_OPTIONS="$MENU_OPTIONS $n ${name} " done < $TMP_MENU_FILE whiptail --clear --title "Select your boot option" \ From 19067a9a72e72f7323f9e0802c38cfcb0a93b4aa Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 15 Mar 2022 12:01:49 -0500 Subject: [PATCH 2/4] kexec-select-boot: Simplify boot selection confirmation, reverse order Simplify the menu options by removing the duplication of the entry name in the menu selections; instead, use clear verbiage to distinish between booting one time and making the default. And as the majority of the boot menu is shown is when the grub entires have changed and the user is prompted to select a new default, so make that the first/default menu option. Signed-off-by: Matt DeVillier --- initrd/bin/kexec-select-boot | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/initrd/bin/kexec-select-boot b/initrd/bin/kexec-select-boot index cc03920b..dd688f22 100755 --- a/initrd/bin/kexec-select-boot +++ b/initrd/bin/kexec-select-boot @@ -134,9 +134,11 @@ get_menu_option() { confirm_menu_option() { if [ "$gui_menu" = "y" ]; then + default_text="Make default" + [[ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" = "y" ]] && default_text="${default_text} and boot" whiptail $BG_COLOR_WARNING --clear --title "Confirm boot details" \ - --menu "Confirm the boot details for $name:\n\n$option\n\n" 20 120 8 \ - -- 'y' "Boot $name" 'd' "Make $name the default" \ + --menu "Confirm the boot details for $name:\n\n$kernel \n\n" 20 120 8 \ + -- 'd' "${default_text}" 'y' "Boot one time" \ 2>/tmp/whiptail || die "Aborting boot attempt" option_confirm=$(cat /tmp/whiptail) From 025f914eb3d868be80dccac14994d61496b50bc2 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 15 Mar 2022 12:03:04 -0500 Subject: [PATCH 3/4] kexec-select-boot: Skip duplicate prompt when setting new default boot entry The text based prompt isn't needed when using a GUI menu for selection/confirmation, so skip it Signed-off-by: Matt DeVillier --- initrd/bin/kexec-select-boot | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/initrd/bin/kexec-select-boot b/initrd/bin/kexec-select-boot index dd688f22..d0266c46 100755 --- a/initrd/bin/kexec-select-boot +++ b/initrd/bin/kexec-select-boot @@ -185,11 +185,13 @@ scan_options() { } save_default_option() { - read \ - -n 1 \ - -p "Saving a default will modify the disk. Proceed? (Y/n): " \ - default_confirm - echo + if [ "$gui_menu" != "y" ]; then + read \ + -n 1 \ + -p "Saving a default will modify the disk. Proceed? (Y/n): " \ + default_confirm + echo + fi [ "$default_confirm" = "" ] && default_confirm="y" if [[ "$default_confirm" = "y" || "$default_confirm" = "Y" ]]; then From ba054b15c3740228ba3e327c3442a9f7594a9fe8 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 7 Apr 2022 14:30:56 -0500 Subject: [PATCH 4/4] kexec-select-boot: use 'fold' to wrap kernel args at 80 char Prevents truncation via fbwhiptail window Signed-off-by: Matt DeVillier --- initrd/bin/kexec-select-boot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/initrd/bin/kexec-select-boot b/initrd/bin/kexec-select-boot index d0266c46..79bc1931 100755 --- a/initrd/bin/kexec-select-boot +++ b/initrd/bin/kexec-select-boot @@ -137,7 +137,7 @@ confirm_menu_option() { default_text="Make default" [[ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" = "y" ]] && default_text="${default_text} and boot" whiptail $BG_COLOR_WARNING --clear --title "Confirm boot details" \ - --menu "Confirm the boot details for $name:\n\n$kernel \n\n" 20 120 8 \ + Confirm the boot details for $name:\n\n$(echo $kernel| fold -s -w 80) \n\n" 20 120 8 \ -- 'd' "${default_text}" 'y' "Boot one time" \ 2>/tmp/whiptail || die "Aborting boot attempt"