Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 945b24a93bcf61394379dbe410f6e2ee > files > 14

x11-server-1.10.1-1.1.mga1.src.rpm

#!/bin/dash
#
# Trivial egregious hack to load the console keyboard layout into XKB.
#

[ -x /usr/bin/hal-set-property ] || exit 0

. /etc/sysconfig/keyboard > /dev/null 2> /dev/null || exit 0

if [ -z "$XkbLayout" ]; then
 [ -x /usr/sbin/keyboarddrake ] || exit 0
 /usr/sbin/keyboarddrake --migrate 
 . /etc/sysconfig/keyboard 
fi

[ -n "$XkbLayout" ] || exit 0

hal_set () {
    if [ -n "$2" ]; then
	/usr/bin/hal-set-property $DIRECT --udi "$UDI" --key input.xkb.$1 --string "$2"
    else
	/usr/bin/hal-set-property $DIRECT --udi "$UDI" --key input.xkb.$1 --remove
    fi
}

if [ -n "$UDI" ]; then 
    # if $UDI is set, we're being called as a hal callout from
    # 10-x11-keymap.fdi 
    DIRECT="--direct"
    hal_set model $XkbModel
    hal_set layout $XkbLayout
    hal_set variant $XkbVariant
    hal_set options $XkbOptions
else
    # $UDI is not set, we're called stand-alone and we must set the keyboard
    # properties on all applicable devices
    for UDI in $(hal-find-by-capability --capability input.keys); do
        hal_set model $XkbModel
        hal_set layout $XkbLayout
        hal_set variant $XkbVariant
        hal_set options $XkbOptions
    done
fi