void-packages/srcpkgs/xbps-casper/files/scripts/casper-bottom/11keymap

49 lines
889 B
Bash
Executable File

#! /bin/sh
PREREQ=""
DESCRIPTION="Setting up system keymap"
[ -r /scripts/functions ] && . /scripts/functions
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
log_begin_msg "$DESCRIPTION"
# commandline
for x in $(cat /proc/cmdline); do
case $x in
keymap=*)
keymap=${x#keymap=}
set_keymap="true"
;;
esac
done
if [ "${set_keymap}" ]; then
sed -i -e "s|\(KEYMAP=\).*|\1${keymap}|" ${rootmnt}/etc/vconsole.conf
fi
# Setup keymap for X.org evdev.
if [ -r "${rootmnt}/etc/udev/rules.d/75-x11-input.rules" ]; then
sed -i -e "s|\(ENV{xkblayout}\=\)\"us\"|\1\"${keymap}\"|" \
${rootmnt}/etc/udev/rules.d/75-x11-input.rules
fi
# Setup keymap for lightdm.
if [ -r "${rootmnt}/etc/lightdm.conf" ]; then
sed -i -e "s|^\#\(layout=\).*|\1${keymap}|" ${rootmnt}/etc/lightdm.conf
fi
log_end_msg