File: localed-x11-keymap

package info (click to toggle)
systemd 232-25+deb9u11
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 46,164 kB
  • sloc: ansic: 290,592; xml: 49,217; makefile: 5,503; sh: 4,031; python: 2,596; perl: 1,838
file content (44 lines) | stat: -rwxr-xr-x 1,219 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
set -e

. `dirname $0`/assert.sh

ORIG_KBD=`cat /etc/default/keyboard`

cleanup() {
    # reset locale to original
    echo "$ORIG_KBD" > /etc/default/keyboard
    rm -f /etc/X11/xorg.conf.d/00-keyboard.conf
}
trap cleanup EXIT INT QUIT PIPE

# should activate daemon and work
STATUS=`localectl`
assert_in "X11 Layout:" "`localectl --no-pager`"

# change layout
assert_eq "`localectl --no-pager set-x11-keymap et pc101 2>&1`" ""
sync

if [ -n "$TEST_UPSTREAM" ]; then
    # Upstream writes xorg.conf.d file
    assert_in 'Option "XkbLayout" "et' "`cat /etc/X11/xorg.conf.d/00-keyboard.conf`"
    assert_in 'Option "XkbModel" "pc101"' "`cat /etc/X11/xorg.conf.d/00-keyboard.conf`"
else
    # Debian console-setup config file
    assert_in 'XKBLAYOUT="\?et"\?' "`cat /etc/default/keyboard`"
    assert_in 'XKBMODEL="\?pc101"\?' "`cat /etc/default/keyboard`"

    ! [ -f /etc/X11/xorg.conf.d/00-keyboard.conf ]
fi

STATUS=`localectl --no-pager`
assert_in "X11 Layout: et" "$STATUS"
assert_in "X11 Model: pc101" "$STATUS"

# gets along without config file
if [ -z "$TEST_UPSTREAM" ]; then
    rm /etc/default/keyboard
    systemctl stop systemd-localed
    assert_in "X11 Layout: n/a" "`localectl --no-pager`"
fi