summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorbclemens2017-09-25 17:59:11 +0900
committerbclemens2017-09-25 17:59:11 +0900
commit4b53cdc3e61fbbbd8f338a77bb8bf37fec4b3ba6 (patch)
tree73ca6d2468f588f7efb0cf73962b815cd9fdaa49
downloadaur-4b53cdc3e61fbbbd8f338a77bb8bf37fec4b3ba6.tar.gz
initial commit
-rw-r--r--.SRCINFO14
-rw-r--r--PKGBUILD18
-rw-r--r--dict-freedict-jpn-eng.install78
3 files changed, 110 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..b402d20c8f6d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,14 @@
+pkgbase = dict-freedict-deu-eng
+ pkgdesc = Japanese -> English dictionary for dictd et al. from Freedict.org
+ pkgver = 0.1
+ pkgrel = 1
+ url = http://www.freedict.org/
+ install = dict-freedict-jpn-eng.install
+ arch = any
+ license = GPL
+ optdepends = dictd: dict client and server
+ source = https://sourceforge.net/projects/freedict/files/Japanese%20-%20English/0.1/freedict-jpn-eng-0.1.tar.bz2
+ md5sums = bc3b8e3f9b93432ddefff7c3505f0001
+
+pkgname = dict-freedict-jpn-eng
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..8b015a17de3e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,18 @@
+# Maintainer: Brian Clemens <brian@teknik.io>
+pkgname=dict-freedict-jpn-eng
+pkgver=0.1
+pkgrel=1
+pkgdesc="Japanese -> English dictionary for dictd et al. from Freedict.org"
+arch=('any')
+url="http://www.freedict.org/"
+license=('GPL')
+optdepends=('dictd: dict client and server')
+install=$pkgname.install
+source=("https://sourceforge.net/projects/freedict/files/Japanese%20-%20English/$pkgver/freedict-jpn-eng-$pkgver.tar.bz2")
+md5sums=('bc3b8e3f9b93432ddefff7c3505f0001')
+
+package()
+{
+ mkdir -p "$pkgdir/usr/share/dictd"
+ cp jpn-eng/jpn-eng.{dict.dz,index} "$pkgdir/usr/share/dictd/"
+}
diff --git a/dict-freedict-jpn-eng.install b/dict-freedict-jpn-eng.install
new file mode 100644
index 000000000000..cffdf314c329
--- /dev/null
+++ b/dict-freedict-jpn-eng.install
@@ -0,0 +1,78 @@
+pkgname=dict-freedict-jpn-eng
+basename=jpn-eng
+dictd_conf=/etc/dict/dictd.conf
+datadir=/usr/share/dictd
+conf="database $basename {
+ data $datadir/$basename.dict.dz
+ index $datadir/$basename.index
+}"
+
+post_install()
+{
+ echo
+ if pacman -Qq dictd > /dev/null 2>&1
+ then
+ if grep -q "^database *$basename" "$dictd_conf"
+ then
+ echo "$pkgname already configured in $dictd_conf"
+ else
+ echo "Adding configuration for $pkgname to $dictd_conf"
+ echo "$conf" >> "$dictd_conf"
+ fi
+
+ if systemctl -q is-active dictd.service
+ then
+ echo "Restarting dictd service in order to" \
+ "use the new dictionary database"
+ systemctl restart dictd.service
+ else
+ echo "Starting dictd service in order to" \
+ "use the new dictionary database"
+ systemctl start dictd.service
+ fi
+ else
+ echo "dictd does not appear to be installed."
+ echo "In order to use this database you should either" \
+ "install dictd or alternatively" \
+ "another dict server and configure it on your own."
+ fi
+ echo
+}
+
+post_upgrade()
+{
+ if pacman -Qq dictd > /dev/null 2>&1 && \
+ systemctl -q is-active dictd.service
+ then
+ echo -e "\nRestarting dictd service in order to" \
+ "use the updated dictionary database"
+ systemctl restart dictd.service
+ fi
+}
+
+post_remove()
+{
+ if pacman -Qq dictd > /dev/null 2>&1
+ then
+ current_conf="$(grep -A 3 "^database *$basename" "$dictd_conf")"
+ if test -n "$current_conf"
+ then
+ echo
+ if test "$current_conf" = "$conf"
+ then
+ echo "Removing configuration for $pkgname from $dictd_conf"
+ sed -i "/database $basename {/,/}/d" "$dictd_conf"
+ else
+ echo "User created / modified configuration" \
+ "for $pkgname in $dictd_conf is left untouched."
+ fi
+ fi
+
+ if systemctl -q is-active dictd.service
+ then
+ echo "Restarting dictd service in order to" \
+ "stop using the removed dictionary database"
+ systemctl restart dictd.service
+ fi
+ fi
+}