diff --git a/initrd/bin/gui-init b/initrd/bin/gui-init index f48060cb..08335488 100755 --- a/initrd/bin/gui-init +++ b/initrd/bin/gui-init @@ -82,7 +82,7 @@ while true; do if [ "$totp_confirm" = "m" ]; then # Try to select a kernel from the menu mount_boot - kexec-select-boot -m -b /boot -c "grub.cfg" + kexec-select-boot -m -b /boot -c "grub.cfg" -g continue fi diff --git a/initrd/bin/kexec-select-boot b/initrd/bin/kexec-select-boot index 034890bb..c3cc05f1 100755 --- a/initrd/bin/kexec-select-boot +++ b/initrd/bin/kexec-select-boot @@ -12,7 +12,8 @@ valid_hash="n" valid_global_hash="n" valid_rollback="n" force_menu="n" -while getopts "b:d:p:a:r:c:uim" arg; do +gui_menu="n" +while getopts "b:d:p:a:r:c:uimg" arg; do case $arg in b) bootdir="$OPTARG" ;; d) paramsdev="$OPTARG" ;; @@ -23,6 +24,7 @@ while getopts "b:d:p:a:r:c:uim" arg; do u) unique="y" ;; m) force_menu="y" ;; i) valid_hash="y"; valid_rollback="y" ;; + g) gui_menu="y" ;; esac done @@ -80,6 +82,24 @@ get_menu_option() { if [ $num_options -eq 1 -a $first_menu = "y" ]; then option_index=1 + elif [ "$gui_menu" = "y" ]; then + MENU_OPTIONS="" + n=0 + while read option + do + parse_option + n=`expr $n + 1` + name=$(echo $name | tr " " "_") + kernel=$(echo $kernel | cut -f2 -d " ") + MENU_OPTIONS="$MENU_OPTIONS $n ${name}_[$kernel]" + done < $TMP_MENU_FILE + + whiptail --clear --title "Select your boot option" \ + --menu "Choose the boot option [1-$n, a to abort]:" 20 120 8 \ + -- $MENU_OPTIONS \ + 2>/tmp/whiptail || die "Aborting boot attempt" + + option_index=$(cat /tmp/whiptail) else echo "+++ Select your boot option:" n=0 @@ -105,14 +125,23 @@ get_menu_option() { } confirm_menu_option() { - echo "+++ Please confirm the boot details for $name:" - echo $option + if [ "$gui_menu" = "y" ]; then + whiptail --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" \ + 2>/tmp/whiptail || die "Aborting boot attempt" - read \ - -n 1 \ - -p "Confirm selection by pressing 'y', make default with 'd': " \ - option_confirm - echo + option_confirm=$(cat /tmp/whiptail) + else + echo "+++ Please confirm the boot details for $name:" + echo $option + + read \ + -n 1 \ + -p "Confirm selection by pressing 'y', make default with 'd': " \ + option_confirm + echo + fi } parse_option() {