diff --git a/install.sh b/install.sh index a011b23..4d042db 100755 --- a/install.sh +++ b/install.sh @@ -31,12 +31,13 @@ ultra_quiet() { [ $(whoami) != "root" ] && echo "Please run as root" && exit 1 ### CD TO MY DIR ### -cd "$(basename "$0")" +cd "$(dirname "$0")" ### URLs ### FZF_DOWNLOAD="$(curl -s https://api.github.com/repos/junegunn/fzf/releases/latest | grep linux_amd64 | sed -nE 's/^\s*"browser_download_url":\s*"(.*)"\s*$/\1/p')" PARTED_DOWNLOAD="https://archlinux.org/packages/extra/x86_64/parted/download" POST_INSTALL_SCRIPT="https://raw.githubusercontent.com/augustogunsch/install-arch/master/post-install.sh" +KEYBOARD_MAP="https://raw.githubusercontent.com/augustogunsch/install-arch/master/keyboard-map.csv" ### COLORS ### RED='\033[0;31m' @@ -229,13 +230,22 @@ set_locale() { echo "done" echo -n "Setting keyboard layout..." - echo "keymap=\"$XKBD_LAYOUT\"" > /etc/conf.d/keymaps echo "KEYMAP=\"$KBD_LAYOUT\"" > /etc/vconsole.conf + + XKBD="$(awk -F: '$1 ~ /^'$KBD_LAYOUT'$/ {print $0; exit 0}' keyboard-map.csv)" + XKBD_LAYOUT="$(echo $XKBD | awk -F: '{print $2}')" + XKBD_MODEL="$(echo $XKBD | awk -F: '{print $3}')" + XKBD_VARIANT="$(echo $XKBD | awk -F: '{print $4}')" + XKBD_OPTIONS="$(echo $XKBD | awk -F: '{print $5}')" + echo "keymap=\"$XKBD_LAYOUT\"" > /etc/conf.d/keymaps local XKBD_CONF="/etc/X11/xorg.conf.d/00-keyboard.conf" echo "Section \"InputClass\"" > $XKBD_CONF echo " Identifier \"system-keyboard\"" >> $XKBD_CONF echo " MatchIsKeyboard \"on\"" >> $XKBD_CONF echo " Option \"XkbLayout\" \"$XKBD_LAYOUT\"" >> $XKBD_CONF + echo " Option \"XkbModel\" \"$XKBD_MODEL\"" >> $XKBD_CONF + [ -n $XKBD_VARIANT ] && echo " Option \"XkbVariant\" \"$XKBD_VARIANT\"" >> $XKBD_CONF + [ -n $XKBD_OPTIONS ] && echo " Option \"XkbOptions\" \"$XKBD_OPTIONS\"" >> $XKBD_CONF echo "EndSection" >> $XKBD_CONF echo "done" } @@ -316,15 +326,9 @@ prompt_all() { echo "Choose locale:" LOCALE=$(sed '/^#\s/D' < /etc/locale.gen | sed '/^#$/D' | sed 's/^#//' | fzf --layout=reverse --height=20) - qpushd /usr/share/kbd/keymaps - local layouts="$(ls -1 **/*.map.gz | sed -E 's/^(.*)\.map\.gz$/\1/')" - qpopd - echo "Choose console keyboard layout:" - KBD_LAYOUT="$(basename $(echo -e "$layouts" | fzf --layout=reverse --height=20))" - - echo "Choose X11 keyboard layout:" - XKBD_LAYOUT="$(awk 'BEGIN {toprint=0} $0 ~ /^[[:blank:]]*$/ {toprint=0} $2 ~ /layout/ {toprint=1; next} {if (toprint) {print $1} }' \ - /usr/share/X11/xkb/rules/base.lst | head -n -1 | fzf --layout=reverse --height=20)" + [ -f keyboard-map.csv ] || curl -sL "$KEYBOARD_MAP" -o keyboard-map.csv + echo "Choose keyboard layout:" + KBD_LAYOUT="$(awk -F: '{print $1}' keyboard-map.csv | fzf --layout=reverse --height=20)" ask_password root ROOT_PASSWORD="$USER_PASSWORD" diff --git a/keyboard-map.csv b/keyboard-map.csv new file mode 100644 index 0000000..282576b --- /dev/null +++ b/keyboard-map.csv @@ -0,0 +1,69 @@ +sr-cy,rs,pc105,, +sv-latin1,se,pc105,, +cf,ca(fr),pc105,, +fr_CH-latin1,ch,pc105,fr, +fr-latin9,fr,pc105,latin9, +dev,"dev,us",pc105,,"grp:shifts_toggle,grp_led:scroll" +sk-qwerty,sk,pc105,,qwerty +et,ee,pc105,, +ar-qwerty-digits,"ara,us",pc105,qwerty_digits,"grp:shifts_toggle,grp_led:scroll" +ar-azerty,"ara,us",pc105,azerty,"grp:shifts_toggle,grp_led:scroll" +ie,ie,pc105,, +ro-cedilla,ro,pc105,cedilla, +es,es,pc105,, +pl2,pl,pc105,, +cz-lat2,cz,pc105,qwerty, +ru,"ru,us",pc105,,"grp:shifts_toggle,grp_led:scroll" +dvorak,us,pc105,dvorak, +bg_bds-utf8,"bg,us",pc105,,"grp:shifts_toggle,grp_led:scroll" +no,no,pc105,, +de-latin1-nodeadkeys,de,pc105,nodeadkeys, +ben,"in,us",pc105,ben,"grp:shifts_toggle,grp_led:scroll" +ar-azerty-digits,"ara,us",pc105,azerty_digits,"grp:shifts_toggle,grp_led:scroll" +ar-qwerty,"ara,us",pc105,qwerty,"grp:shifts_toggle,grp_led:scroll" +tj,tj,pc105,, +ro-std-cedilla,ro,pc105,std_cedilla, +pt-latin1,pt,pc105,, +us-acentos,us,pc105,intl, +ro,ro,pc105,, +br-abnt2,br,abnt2,, +ar-digits,"ara,us",pc105,digits,"grp:shifts_toggle,grp_led:scroll" +cz-us-qwertz,"cz,us",pc105,,"grp:shifts_toggle,grp_led:scroll" +it-ibm,it,pc105,, +bg_pho-utf8,"bg,us",pc105,",phonetic","grp:shifts_toggle,grp_led:scroll" +fr-pc,fr,pc105,, +dk,dk,pc105,, +be-latin1,be,pc105,, +sg-latin1,ch,pc105,de_nodeadkeys, +fr-latin1,fr,pc105,, +ua-utf,"ua,us",pc105,,"grp:shifts_toggle,grp_led:scroll" +tml-uni,"in,us",pc105,tam_TAB,"grp:shifts_toggle,grp_led:scroll" +it,it,pc105,, +fr,fr,pc105,, +dk-latin1,dk,pc105,, +fr_CH,ch,pc105,fr, +fi,fi,pc105,, +sr-latin,rs,pc105,latin, +hu,hu,pc105,, +it2,it,pc105,, +fi-latin1,fi,pc105,, +ben-probhat,"in,us",pc105,ben_probhat,"grp:shifts_toggle,grp_led:scroll" +croat,hr,pc105,, +jp106,jp,jp106,, +hu101,hu,pc105,qwerty, +slovene,si,pc105,, +tml-inscript,"in,us",pc105,tam,"grp:shifts_toggle,grp_led:scroll" +de-latin1,de,pc105,, +ro-std,ro,pc105,std, +ko,kr,pc105,, +us,us,pc105+inet,, +la-latin1,latam,pc105,, +gur,"gur,us",pc105,,"grp:shifts_toggle,grp_led:scroll" +de,de,pc105,, +is-latin1,is,pc105,, +uk,gb,pc105,, +guj,"in,us",pc105,guj,"grp:shifts_toggle,grp_led:scroll" +trq,tr,pc105,, +mk-utf,"mkd,us",pc105,,"grp:shifts_toggle,grp_led:scroll" +nl,nl,pc105,, +sg,ch,pc105,de_nodeadkeys, diff --git a/post-install.sh b/post-install.sh index b565c99..0061ca8 100755 --- a/post-install.sh +++ b/post-install.sh @@ -22,7 +22,7 @@ quiet() { } ### CD TO MY DIR ### -cd "$(basename "$0")" +cd "$(dirname "$0")" ### URLs ### DOTFILES="https://github.com/augustogunsch/dotfiles"