mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2025-12-06 07:12:01 +01:00
Use localectl to set kbd and x11 keymaps. Order sysresccd-initialize.service before getty-pre.target (pasive target, pulled in manually) to ensure console keymap is proper configured when getty@.service runs. Fixes #74
24 lines
773 B
Bash
Executable file
24 lines
773 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Pass the name of the keyboard layout to load it directly (eg: "setkmap us")
|
|
# Pass no argument to display a menu a choose the keyboard layout from the list
|
|
|
|
keymaps=$(localectl list-keymaps)
|
|
|
|
if test -n "${1}" && localectl list-keymaps | grep -q "${1}"
|
|
then
|
|
keymap="${1}"
|
|
else
|
|
exec 3>&1
|
|
keymap=$(/sbin/dialog --title "Keyboard layout" --menu "Choose a keyboard layout" 25 50 20 $(for item in ${keymaps[@]}; do echo ${item} "-" ; done) 2>&1 1>&3) || exit 1
|
|
exec 3>&-
|
|
fi
|
|
|
|
localectl set-keymap ${keymap}
|
|
|
|
if [[ $DISPLAY ]] && [[ -r /etc/X11/xorg.conf.d/00-keyboard.conf ]]; then
|
|
# X11 is already running
|
|
x11keymap=$(awk '/^\s*Option "XkbLayout"/ { print $3 }' /etc/X11/xorg.conf.d/00-keyboard.conf)
|
|
setxkbmap -layout ${x11keymap}
|
|
fi
|