summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukáš Jirkovský2015-08-28 12:50:04 +0200
committerLukáš Jirkovský2015-08-28 12:50:04 +0200
commit02c9858eae549039848b29fbf90b878337c77486 (patch)
treedb3388328a57c3e8b485c7909df7608dfb5cd362
parentc4df6270f41cfb6e5ca5ebf60c7bff0016cdfed4 (diff)
downloadaur-02c9858eae549039848b29fbf90b878337c77486.tar.gz
update to use xmlstarlet
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD24
-rw-r--r--vok.install108
-rw-r--r--vok.xml35
4 files changed, 90 insertions, 83 deletions
diff --git a/.SRCINFO b/.SRCINFO
index bcaa0e62ed9..4d032eb8313 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,19 @@
pkgbase = vok
pkgdesc = Vogo's Keyboard for Xorg 7 (Czech)
pkgver = 1.0
- pkgrel = 9
+ pkgrel = 10
url = http://www.abclinuxu.cz/blog/origami/2006/12/21/162644
install = vok.install
arch = i686
arch = x86_64
license = custom
depends = grep
- depends = qizxopen
+ depends = xmlstarlet
depends = perl
source = http://vogo.unas.cz/files/vok/vok-1.0.tar.bz2
+ source = vok.xml
md5sums = f8e4a38568e42d21a6903fe4755eec2d
+ md5sums = 038d336f9d69b41b90eb031c336991e4
pkgname = vok
diff --git a/PKGBUILD b/PKGBUILD
index 170000b3ccc..6ab298f1394 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,22 +1,22 @@
+# Maintainer: Lukas Jirkovsky <l.jirkovsky@gmail.com>
# Contributor: jose <jose1711 [at] gmail (dot) com>
-
pkgname=vok
pkgver=1.0
-pkgrel=9
+pkgrel=10
pkgdesc="Vogo's Keyboard for Xorg 7 (Czech)"
arch=('i686' 'x86_64')
url="http://www.abclinuxu.cz/blog/origami/2006/12/21/162644"
-license="custom"
-depends=('grep' 'qizxopen' 'perl')
+license=("custom")
+depends=('grep' 'xmlstarlet' 'perl')
install='vok.install'
-source=("http://vogo.unas.cz/files/${pkgname}/${pkgname}-${pkgver}.tar.bz2")
-md5sums=('f8e4a38568e42d21a6903fe4755eec2d')
-
-build() {
-true
-}
+source=("http://vogo.unas.cz/files/${pkgname}/${pkgname}-${pkgver}.tar.bz2" \
+ "vok.xml")
+md5sums=('f8e4a38568e42d21a6903fe4755eec2d'
+ '038d336f9d69b41b90eb031c336991e4')
package() {
-mkdir -p $pkgdir/usr/share/X11/xkb/symbols/
-cp $srcdir/vok $pkgdir/usr/share/X11/xkb/symbols/
+ cd "$srcdir"
+ install -D -m644 vok "$pkgdir/usr/share/X11/xkb/symbols/vok"
+ install -D -m644 vok.xml "$pkgdir/usr/share/vok/vok.xml"
}
+
diff --git a/vok.install b/vok.install
index 179a7754544..1369b62bfdb 100644
--- a/vok.install
+++ b/vok.install
@@ -1,88 +1,58 @@
+
+# tests whether vok is installed
+test_vok() {
+ return `xml sel -t -v 'count(//layoutList/layout/configItem/name[.="vok"])' /usr/share/X11/xkb/rules/evdev.xml`
+}
+
+# insert vok to the layout list
+# uses a nasty trick of appending the vok layout to the end of the file
+# and then moving the layout to its place
+insert_vok() {
+ # prepare a temp file
+ TMPFILE=`mktemp`
+ head -n -1 /usr/share/X11/xkb/rules/evdev.xml >> $TMPFILE
+ cat /usr/share/vok/vok.xml >> $TMPFILE
+ tail -n 1 /usr/share/X11/xkb/rules/evdev.xml >> $TMPFILE
+ # move the vok layout to its place
+ xml ed -L -m '//layout[configItem/name="vok"]' '//layoutList' $TMPFILE
+ # move the temp file to evdev.xml
+ cat $TMPFILE > /usr/share/X11/xkb/rules/evdev.xml
+}
+
+# removes vok from the layout list
+remove_vok() {
+ xml ed -L -d '//layout[configItem/name="vok"]' /usr/share/X11/xkb/rules/evdev.xml
+}
+
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>
+ insert_vok
-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;)
+
+ if test_vok ; then
+ insert_vok
+ fi
+
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
-}
+ 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
-op=$1
-shift
+ remove_vok
+}
-$op "$@"
diff --git a/vok.xml b/vok.xml
new file mode 100644
index 00000000000..12a6f4530c5
--- /dev/null
+++ b/vok.xml
@@ -0,0 +1,35 @@
+<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> \ No newline at end of file