Merge pull request #110 from oberon2007/keymap

move keymap to initial language selection
This commit is contained in:
Bernhard Landauer 2017-03-14 11:57:54 +00:00 committed by GitHub
commit cd4461602d
5 changed files with 55 additions and 55 deletions

View File

@ -11,7 +11,7 @@ BIN = \
bin/manjaro-architect bin/manjaro-architect
LIBS = \ LIBS = \
lib/ini_val.sh \ lib/ini_val.sh \
lib/util.sh \ lib/util.sh \
lib/util-advanced.sh \ lib/util-advanced.sh \
lib/util-base.sh \ lib/util-base.sh \

View File

@ -1,7 +1,6 @@
Main Menu Main Menu
├── Prepare ├── Prepare
│ ├── keymap
│ ├── show devices │ ├── show devices
│ ├── partition │ ├── partition
│ ├── luks │ ├── luks

View File

@ -538,35 +538,6 @@ run_mkinitcpio() {
check_for_error "$FUNCNAME" "$?" 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 "\n$_VCKeymapBody\n " 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 # locale array generation code adapted from the Manjaro 0.8 installer
set_locale() { set_locale() {
LOCALES="" LOCALES=""

View File

@ -53,30 +53,27 @@ prep_menu() {
local PARENT="$FUNCNAME" local PARENT="$FUNCNAME"
declare -i loopmenu=1 declare -i loopmenu=1
while ((loopmenu)); do while ((loopmenu)); do
submenu 7 submenu 6
DIALOG " $_PrepMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n " 0 0 7 \ DIALOG " $_PrepMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n$_PrepMenuBody\n " 0 0 6 \
"1" "$_VCKeymapTitle" \ "1" "$_DevShowOpt" \
"2" "$_DevShowOpt" \ "2" "$_PrepPartDisk" \
"3" "$_PrepPartDisk" \ "3" "$_PrepLUKS" \
"4" "$_PrepLUKS" \ "4" "$_PrepLVM $_PrepLVM2" \
"5" "$_PrepLVM $_PrepLVM2" \ "5" "$_PrepMntPart" \
"6" "$_PrepMntPart" \ "6" "$_Back" 2>${ANSWER}
"7" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER}) HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in case $(cat ${ANSWER}) in
"1") set_keymap "1") show_devices
;; ;;
"2") show_devices "2") umount_partitions
;;
"3") umount_partitions
select_device && create_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 *) loopmenu=0
return 0 return 0

View File

@ -21,6 +21,7 @@ NW_CMD="" # command to launch the available network client
# Locale and Language # Locale and Language
LANGSEL="/tmp/.language" LANGSEL="/tmp/.language"
KEYSEL="/tmp/.keymap"
CURR_LOCALE="en_US.UTF-8" # Default Locale CURR_LOCALE="en_US.UTF-8" # Default Locale
FONT="" # Set new font if necessary FONT="" # Set new font if necessary
KEYMAP="us" # Virtual console keymap. Default is "us" KEYMAP="us" # Virtual console keymap. Default is "us"
@ -210,6 +211,7 @@ check_for_error() {
# Add locale on-the-fly and sets source translation file for installer # Add locale on-the-fly and sets source translation file for installer
select_language() { select_language() {
fl="1" # terminus-font variation supporting most languages, to be processed in set_keymap()
if [[ $(cat ${LANGSEL} 2>/dev/null) == "" ]]; then if [[ $(cat ${LANGSEL} 2>/dev/null) == "" ]]; then
DIALOG " Select Language " --default-item '3' --menu "\n " 0 0 11 \ DIALOG " Select Language " --default-item '3' --menu "\n " 0 0 11 \
"1" $"Danish|(da_DK)" \ "1" $"Danish|(da_DK)" \
@ -243,7 +245,7 @@ select_language() {
;; ;;
"6") source $DATADIR/translations/hungarian.trans "6") source $DATADIR/translations/hungarian.trans
CURR_LOCALE="hu_HU.UTF-8" CURR_LOCALE="hu_HU.UTF-8"
FONT="ter-216n" fl="2"
;; ;;
"7") source $DATADIR/translations/italian.trans "7") source $DATADIR/translations/italian.trans
CURR_LOCALE="it_IT.UTF-8" CURR_LOCALE="it_IT.UTF-8"
@ -256,7 +258,7 @@ select_language() {
;; ;;
"10") source $DATADIR/translations/russian.trans "10") source $DATADIR/translations/russian.trans
CURR_LOCALE="ru_RU.UTF-8" CURR_LOCALE="ru_RU.UTF-8"
FONT="ter-u16n" fl="u"
;; ;;
"11") source $DATADIR/translations/spanish.trans "11") source $DATADIR/translations/spanish.trans
CURR_LOCALE="es_ES.UTF-8" CURR_LOCALE="es_ES.UTF-8"
@ -265,21 +267,52 @@ select_language() {
;; ;;
esac esac
if [[ $(cat ${KEYSEL} 2>/dev/null) == "" ]]; then
set_keymap
fi
# Generate the chosen locale and set the language # Generate the chosen locale and set the language
DIALOG " $_Config " --infobox "\n$_ApplySet\n " 0 0 DIALOG " $_Config " --infobox "\n$_ApplySet\n " 0 0
sleep 2
sed -i "s/#${CURR_LOCALE}/${CURR_LOCALE}/" /etc/locale.gen sed -i "s/#${CURR_LOCALE}/${CURR_LOCALE}/" /etc/locale.gen
locale-gen >/dev/null 2>$ERR locale-gen >/dev/null 2>$ERR
export LANG=${CURR_LOCALE} export LANG=${CURR_LOCALE}
check_for_error "set LANG=${CURR_LOCALE}" $? check_for_error "set LANG=${CURR_LOCALE}" $?
ini system.lang "$CURR_LOCALE" ini system.lang "$CURR_LOCALE"
}
[[ $FONT != "" ]] && { # virtual console keymap and font
setfont $FONT 2>$ERR set_keymap() {
check_for_error "set font $FONT" $? KEYMAPS=""
ini system.font "$FONT" 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>${KEYSEL} || return 0
KEYMAP=$(cat ${KEYSEL})
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
setfont $FONT 2>$ERR
check_for_error "set font $FONT" $?
ini system.font "$FONT"
} }
mk_connection() { mk_connection() {