From 02f45d133e5ab923a830345d103557b173e294a4 Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Mon, 13 Mar 2017 15:56:23 +0100 Subject: [PATCH 1/5] include set_keymap in initial language selection --- lib/util-base.sh | 29 ----------------------------- lib/util-menu.sh | 29 +++++++++++++---------------- lib/util.sh | 46 +++++++++++++++++++++++++++++++++++++++------- 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/lib/util-base.sh b/lib/util-base.sh index 2ebc727..8de3c6a 100644 --- a/lib/util-base.sh +++ b/lib/util-base.sh @@ -549,35 +549,6 @@ run_mkinitcpio() { check_for_error "$FUNCNAME" "$?" } -# virtual console keymap -set_keymap() { - KEYMAPS="" - for i in $(ls -R /usr/share/kbd/keymaps | grep "map.gz" | sed 's/\.map\.gz//g' | sort); do - KEYMAPS="${KEYMAPS} ${i} -" - done - - DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || return 0 - KEYMAP=$(cat ${ANSWER}) - - loadkeys $KEYMAP 2>$ERR - check_for_error "loadkeys $KEYMAP" "$?" - ini linux.keymap "$KEYMAP" - # set keymap for openrc too - echo "keymap=\"$KEYMAP\"" > /tmp/keymap - biggest_resolution=$(head -n 1 /sys/class/drm/card*/*/modes | awk -F'[^0-9]*' '{print $1}' | awk 'BEGIN{a= 0}{if ($1>a) a=$1 fi} END{print a}') - # Choose terminus font size depending on resolution - if [[ $biggest_resolution -gt 1920 ]]; then - FONT=ter-124n - elif [[ $biggest_resolution -eq 1920 ]]; then - FONT=ter-118n - else - FONT=ter-114n - fi - ini linux.font "$FONT" - echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf - echo -e "consolefont=\"${FONT}\"" > /tmp/consolefont -} - # locale array generation code adapted from the Manjaro 0.8 installer set_locale() { LOCALES="" diff --git a/lib/util-menu.sh b/lib/util-menu.sh index 071f82b..752b8c6 100644 --- a/lib/util-menu.sh +++ b/lib/util-menu.sh @@ -53,30 +53,27 @@ prep_menu() { local PARENT="$FUNCNAME" declare -i loopmenu=1 while ((loopmenu)); do - submenu 7 - DIALOG " $_PrepMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_PrepMenuBody" 0 0 7 \ - "1" "$_VCKeymapTitle" \ - "2" "$_DevShowOpt" \ - "3" "$_PrepPartDisk" \ - "4" "$_PrepLUKS" \ - "5" "$_PrepLVM $_PrepLVM2" \ - "6" "$_PrepMntPart" \ - "7" "$_Back" 2>${ANSWER} + submenu 6 + DIALOG " $_PrepMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_PrepMenuBody" 0 0 6 \ + "1" "$_DevShowOpt" \ + "2" "$_PrepPartDisk" \ + "3" "$_PrepLUKS" \ + "4" "$_PrepLVM $_PrepLVM2" \ + "5" "$_PrepMntPart" \ + "6" "$_Back" 2>${ANSWER} HIGHLIGHT_SUB=$(cat ${ANSWER}) case $(cat ${ANSWER}) in - "1") set_keymap + "1") show_devices ;; - "2") show_devices - ;; - "3") umount_partitions + "2") umount_partitions select_device && create_partitions ;; - "4") luks_menu + "3") luks_menu ;; - "5") lvm_menu + "4") lvm_menu ;; - "6") mount_partitions + "5") mount_partitions ;; *) loopmenu=0 return 0 diff --git a/lib/util.sh b/lib/util.sh index fb97d00..c114b90 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -206,6 +206,7 @@ check_for_error() { # Add locale on-the-fly and sets source translation file for installer select_language() { + fl="1" # terminus-font variation supporting most languages, to be processed in set_keymap() if [[ $(cat ${LANGSEL} 2>/dev/null) == "" ]]; then DIALOG " Select Language " --default-item '3' --menu "\n$_Lang" 0 0 11 \ "1" $"Danish|(da_DK)" \ @@ -239,7 +240,7 @@ select_language() { ;; "6") source $DATADIR/translations/hungarian.trans CURR_LOCALE="hu_HU.UTF-8" - FONT="ter-216n" + fl="2" ;; "7") source $DATADIR/translations/italian.trans CURR_LOCALE="it_IT.UTF-8" @@ -252,7 +253,7 @@ select_language() { ;; "10") source $DATADIR/translations/russian.trans CURR_LOCALE="ru_RU.UTF-8" - FONT="ter-u16n" + fl="u" ;; "11") source $DATADIR/translations/spanish.trans CURR_LOCALE="es_ES.UTF-8" @@ -261,21 +262,52 @@ select_language() { ;; esac + set_keymap + # Generate the chosen locale and set the language DIALOG " $_Config " --infobox "$_ApplySet" 0 0 - sleep 2 sed -i "s/#${CURR_LOCALE}/${CURR_LOCALE}/" /etc/locale.gen locale-gen >/dev/null 2>$ERR export LANG=${CURR_LOCALE} check_for_error "set LANG=${CURR_LOCALE}" $? ini system.lang "$CURR_LOCALE" + } +} + +# virtual console keymap and font +set_keymap() { + KEYMAPS="" + for i in $(ls -R /usr/share/kbd/keymaps | grep "map.gz" | sed 's/\.map\.gz//g' | sort); do + KEYMAPS="${KEYMAPS} ${i} -" + done + + DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || return 0 + KEYMAP=$(cat ${ANSWER}) + + loadkeys $KEYMAP 2>$ERR + check_for_error "loadkeys $KEYMAP" "$?" + ini linux.keymap "$KEYMAP" + # set keymap for openrc too + echo "keymap=\"$KEYMAP\"" > /tmp/keymap + biggest_resolution=$(head -n 1 /sys/class/drm/card*/*/modes | awk -F'[^0-9]*' '{print $1}' | awk 'BEGIN{a= 0}{if ($1>a) a=$1 fi} END{print a}') + # Choose terminus font size depending on resolution + if [[ $biggest_resolution -gt 1920 ]]; then + fs="24" + elif [[ $biggest_resolution -eq 1920 ]]; then + fs="18" + else + fs="16" + fi + FONT="ter-${fl}${fs}n" + ini linux.font "$FONT" + echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf + echo -e "consolefont=\"${FONT}\"" > /tmp/consolefont [[ $FONT != "" ]] && { - setfont $FONT 2>$ERR - check_for_error "set font $FONT" $? - ini system.font "$FONT" - } + setfont $FONT 2>$ERR + check_for_error "set font $FONT" $? + ini system.font "$FONT" } mk_connection() { From f747a991585f1807e1ee5781e207abe98e8ceec1 Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Mon, 13 Mar 2017 16:05:57 +0100 Subject: [PATCH 2/5] correction and upd menu map --- data/menu_layout | 1 - lib/util.sh | 2 -- 2 files changed, 3 deletions(-) diff --git a/data/menu_layout b/data/menu_layout index c19ebaf..e5d3d76 100644 --- a/data/menu_layout +++ b/data/menu_layout @@ -1,7 +1,6 @@ Main Menu │ ├── Prepare -│ ├── keymap │ ├── show devices │ ├── partition │ ├── luks diff --git a/lib/util.sh b/lib/util.sh index c114b90..7d43aea 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -272,7 +272,6 @@ select_language() { check_for_error "set LANG=${CURR_LOCALE}" $? ini system.lang "$CURR_LOCALE" - } } # virtual console keymap and font @@ -304,7 +303,6 @@ set_keymap() { echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf echo -e "consolefont=\"${FONT}\"" > /tmp/consolefont - [[ $FONT != "" ]] && { setfont $FONT 2>$ERR check_for_error "set font $FONT" $? ini system.font "$FONT" From 50086f84384f8e3040a344ca5ba180bf79182ee8 Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Mon, 13 Mar 2017 16:37:48 +0100 Subject: [PATCH 3/5] run set_keymap only once, like set_language --- lib/util.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/util.sh b/lib/util.sh index 7d43aea..61343d2 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -21,6 +21,7 @@ NW_CMD="" # command to launch the available network client # Locale and Language LANGSEL="/tmp/.language" +FONTSEL="/tmp/.keymap" CURR_LOCALE="en_US.UTF-8" # Default Locale FONT="" # Set new font if necessary KEYMAP="us" # Virtual console keymap. Default is "us" @@ -262,7 +263,9 @@ select_language() { ;; esac - set_keymap + if [[ $(cat ${KEYSEL} 2>/dev/null) == "" ]]; then + set_keymap + fi # Generate the chosen locale and set the language DIALOG " $_Config " --infobox "$_ApplySet" 0 0 @@ -281,8 +284,8 @@ set_keymap() { KEYMAPS="${KEYMAPS} ${i} -" done - DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || return 0 - KEYMAP=$(cat ${ANSWER}) + DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${KEYSEL} || return 0 + KEYMAP=$(cat ${KEYSEL}) loadkeys $KEYMAP 2>$ERR check_for_error "loadkeys $KEYMAP" "$?" From 105bdbb8af97d5334ce67704153f0a1d3e5c1083 Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Mon, 13 Mar 2017 16:46:14 +0100 Subject: [PATCH 4/5] upd Makefile with ini_val.sh --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 246a65a..a484592 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ BIN = \ bin/manjaro-architect LIBS = \ + lib/ini_val.sh \ lib/util.sh \ lib/util-advanced.sh \ lib/util-base.sh \ From f7c93642235f3b696836592179eb051537fb41ea Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Mon, 13 Mar 2017 16:56:45 +0100 Subject: [PATCH 5/5] correction varname --- lib/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.sh b/lib/util.sh index 61343d2..885d08b 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -21,7 +21,7 @@ NW_CMD="" # command to launch the available network client # Locale and Language LANGSEL="/tmp/.language" -FONTSEL="/tmp/.keymap" +KEYSEL="/tmp/.keymap" CURR_LOCALE="en_US.UTF-8" # Default Locale FONT="" # Set new font if necessary KEYMAP="us" # Virtual console keymap. Default is "us"