summarylogtreecommitdiffstats
path: root/vok.install
blob: 179a7754544b5f1855c487b60229f328641ba81f (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
post_install() {
  perl -ne '/^[[:blank:]]*vok[[:blank:]]{1,}/ && exit 1' /usr/share/X11/xkb/rules/xorg.lst && (
  sed -i "s/^! layout$/! layout\n  vok             vogo's keyboard (czech)/" /usr/share/X11/xkb/rules/evdev.lst
  sed -i "s/^! variant$/! variant\n  basic           vok: Qwerty (national chars with AltGr)\n  czech           vok: Qwerty (digits with AltGr)\n  qwertz          vok: Qwertz (national chars with AltGr)\n  czech_qwertz    vok: Qwertz (digits with AltGr)/" /usr/share/X11/xkb/rules/xorg.lst;)
tmpfile=$(mktemp)
echo 'copy $d := doc("/usr/share/X11/xkb/rules/evdev.xml")
modify (
insert node

<layout>
      <configItem>
        <name>vok</name>
        <shortDescription>Vogo'\''s kbd</shortDescription>
        <description>Czech keyboard by Vogo</description>
        <languageList><iso639Id>cze</iso639Id></languageList>
        <countryList><iso3166Id>CZ</iso3166Id></countryList>
      </configItem>
      <variantList>
        <variant>
          <configItem>
            <name>basic</name>
            <description>Qwerty (national chars with AltGr)</description>
          </configItem>
        </variant>
        <variant>
          <configItem>
            <name>czech</name>
            <description>Qwerty (digits with AltGr)</description>
          </configItem>
        </variant>
        <variant>
          <configItem>
            <name>qwertz</name>
            <description>Qwertz (national chars with AltGr)</description>
          </configItem>
        </variant>
        <variant>
          <configItem>
            <name>czech_qwertz</name>
            <description>Qwertz (digits with AltGr)</description>
          </configItem>
        </variant>
      </variantList>
</layout>

as first into $d/xkbConfigRegistry/layoutList
)
return $d' | qizx - | /bin/sed '/^ *$/d' > $tmpfile
if [ "${PIPESTATUS[1]}" -eq 0 ]; then
	mv $tmpfile /usr/share/X11/xkb/rules/evdev.xml
fi
chmod a+r /usr/share/X11/xkb/rules/evdev.xml
  echo "-- Please read http://www.abclinuxu.cz/blog/origami/2006/12/21/162644"
  /bin/true
}

post_upgrade() {
  perl -ne '/^[[:blank:]]*vok[[:blank:]]{1,}/ && exit 1' /usr/share/X11/xkb/rules/xorg.lst && (
  sed -i "s/^! layout$/! layout\n  vok             vogo's keyboard (czech)/" /usr/share/X11/xkb/rules/xorg.lst
  sed -i "s/^! variant$/! variant\n  basic           vok: Qwerty (national chars with AltGr)\n  czech           vok: Qwerty (digits with AltGr)\n  qwertz          vok: Qwertz (national chars with AltGr)\n  czech_qwertz    vok: Qwertz (digits with AltGr)/" /usr/share/X11/xkb/rules/xorg.lst;)
  echo "-- Please read http://www.abclinuxu.cz/blog/origami/2006/12/21/162644"
  /bin/true
/bin/true
}

pre_remove() {
sed -ni '/vok             vogo'\''s keyboard (czech)$/!p' /usr/share/X11/xkb/rules/xorg.lst
sed -ni '/  basic           vok: Qwerty (national chars with AltGr)$/!p' /usr/share/X11/xkb/rules/xorg.lst
sed -ni '/  czech           vok: Qwerty (digits with AltGr)/!p' /usr/share/X11/xkb/rules/xorg.lst
sed -ni '/  qwertz          vok: Qwertz (national chars with AltGr)/!p' /usr/share/X11/xkb/rules/xorg.lst
sed -ni '/  czech_qwertz    vok: Qwertz (digits with AltGr)/!p' /usr/share/X11/xkb/rules/xorg.lst
tmpfile=$(mktemp)
echo 'copy $d := doc("/usr/share/X11/xkb/rules/evdev.xml")
modify (
delete node $d/xkbConfigRegistry/layoutList/layout[configItem/name='\''vok'\'']
)
return $d' | qizx - | /bin/sed '/^ *$/d' >$tmpfile
if [ "${PIPESTATUS[1]}" -eq 0 ]; then
        mv $tmpfile /usr/share/X11/xkb/rules/evdev.xml
fi
chmod a+r /usr/share/X11/xkb/rules/evdev.xml
/bin/true
}

op=$1
shift

$op "$@"