From 8678ee05ec51db48474b368a272df2cecb81dcfb Mon Sep 17 00:00:00 2001 From: oddlama Date: Wed, 21 Apr 2021 16:07:49 +0200 Subject: [PATCH] Make keymap selection more intuitive --- configure | 59 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 95fb879..5e25147 100755 --- a/configure +++ b/configure @@ -96,15 +96,14 @@ MENU_ITEMS=( "KEYFILE" ) +SELECTED_MENU_ITEM="" + function HOSTNAME_tag() { echo "Hostname"; } function HOSTNAME_label() { echo "($HOSTNAME)"; } -function HOSTNAME_help() { echo "Enter the desired system hostname here, be aware that when creating mdadm raid arrays, this value will be recorded in metadata block. If you change it later, you should also update the metadata."; } +function HOSTNAME_help() { echo "Enter the desired system hostname here. Be aware that when creating mdadm raid arrays, this value will be recorded in metadata block. If you change it later, you should also update the metadata."; } function HOSTNAME_menu() { local sel sel="$(dialog --clear \ - --help-button --help-label "Menu" \ - --ok-label "Next" --cancel-label "Exit" \ - --extra-button --extra-label "Back" \ --title "Select hostname" \ --inputbox "Enter the hostname for your new system." \ 8 72 "$HOSTNAME" 3>&2 2>&1 1>&3 3>&-)" @@ -124,24 +123,51 @@ function KEYMAP_help() { echo "The default vconsole keymap for the system."; } function KEYMAP_menu() { local items=() local map + local default_item="${1-$KEYMAP}" for map in $(find /usr/share/keymaps/ /usr/share/kbd/keymaps/ -type f -iname '*.map.gz' -printf "%f\n" 2>/dev/null | sort -u); do map="${map%%.map.gz}" - if [[ $map == $KEYMAP ]]; then - items+=("${map}" "off") + if [[ $map == $default_item ]]; then + items+=("$map" "on") else - items+=("${map}" "off") + items+=("$map" "off") fi done local sel sel="$(dialog --clear \ - --help-button --help-label "Menu" \ - --ok-label "Next" --cancel-label "Exit" \ - --extra-button --extra-label "Back" \ --noitem \ --title "Select keymap" \ - --radiolist "Select which keymap to use in the vconsole." \ + --help-button \ + --help-label "Select/OK" \ + --help-status \ + --default-item "$default_item" \ + --default-button help \ + --radiolist "Select which keymap to use in the vconsole. Use to select the keymap and enter to accept your choice." \ 16 72 8 "${items[@]}" 3>&2 2>&1 1>&3 3>&-)" + + local diag_exit="$?" + if [[ $diag_exit == 0 ]]; then + # + KEYMAP="$sel" + elif [[ $diag_exit == 1 ]]; then + # + true + elif [[ $diag_exit == 2 ]]; then + # + KEYMAP_menu "$sel_cur" + fi + else + # + true + fi } function LOCALE_tag() { echo "Locale"; } @@ -296,22 +322,27 @@ function menu() { --title "Gentoo configuration ($RELA_CONFIG_FILE)" \ --extra-button --extra-label "Exit" \ --help-button \ + --default-item "$SELECTED_MENU_ITEM" \ --ok-label "Select" --cancel-label "Save" \ - --menu "This is the gentoo configuration menu. Read and adjust all options below carefully. Save your desired configuration and run ./install afterwards. Use the help if you want further information for any item." \ + --menu "This is the gentoo configuration menu. Read and adjust all options below carefully. Save your desired configuration and run ./install afterwards. Use if you want further information on any option." \ 20 72 12 "${tag_item_list[@]}" 3>&2 2>&1 1>&3 3>&-)" local diag_exit="$?" if [[ $diag_exit == 0 ]]; then #