summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart De Roy2018-06-25 12:50:53 +0200
committerBart De Roy2018-06-25 12:53:21 +0200
commitabd1eecdbbb488670f450a7d4f70e52f91fec96c (patch)
tree48c5888fb3a05e45afb530d111166c6c7b734b50
downloadaur-abd1eecdbbb488670f450a7d4f70e52f91fec96c.tar.gz
initial commit
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD35
-rw-r--r--dict-freedict-eng-nld.install78
3 files changed, 129 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..febdd90574a
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = dict-freedict-eng-nld
+ pkgdesc = English -> Dutch dictionary for dictd et al. from Freedict.org
+ pkgver = 0.2
+ pkgrel = 1
+ url = http://www.freedict.org/
+ install = dict-freedict-eng-nld.install
+ arch = any
+ license = GPL
+ makedepends = dictd
+ makedepends = freedict-tools
+ optdepends = dictd: dict client and server
+ source = https://download.freedict.org/dictionaries/eng-nld/0.2/freedict-eng-nld-0.2.src.tar.xz
+ sha512sums = 671687a683eaecc23c2fc7f7d327d88989918cef25e19ef541a0828d5915d3f675927660a8c175dc6e74751de31e7abe21108ec8c9f354250d42f02336540e1f
+
+pkgname = dict-freedict-eng-nld
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..15fd63a325c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,35 @@
+# Maintainer: Bart De Roy <de dot roy dot bart at gmail dot com>
+_lang=eng-nld
+pkgname=dict-freedict-${_lang}
+pkgver=0.2
+pkgrel=1
+pkgdesc="English -> Dutch dictionary for dictd et al. from Freedict.org"
+arch=('any')
+url="http://www.freedict.org/"
+license=('GPL')
+optdepends=('dictd: dict client and server')
+makedepends=('dictd' 'freedict-tools')
+install=${pkgname}.install
+source=("https://download.freedict.org/dictionaries/${_lang}/${pkgver}/freedict-${_lang}-${pkgver}.src.tar.xz")
+sha512sums=('671687a683eaecc23c2fc7f7d327d88989918cef25e19ef541a0828d5915d3f675927660a8c175dc6e74751de31e7abe21108ec8c9f354250d42f02336540e1f')
+
+build()
+{
+ cd $_lang
+ make FREEDICT_TOOLS=/usr/lib/freedict-tools build-dictd
+}
+
+package()
+{
+ install -m 755 -d "${pkgdir}/usr/share/dictd"
+ install -m 644 -t "${pkgdir}/usr/share/dictd/" \
+ ${_lang}/build/dictd/${_lang}.{dict.dz,index}
+
+ for file in ${_lang}/{AUTHORS,README,NEWS,ChangeLog}
+ do
+ if test -f ${file}
+ then
+ install -m 644 -Dt "${pkgdir}/usr/share/doc/freedict/${_lang}/" ${file}
+ fi
+ done
+}
diff --git a/dict-freedict-eng-nld.install b/dict-freedict-eng-nld.install
new file mode 100644
index 00000000000..955b58a5509
--- /dev/null
+++ b/dict-freedict-eng-nld.install
@@ -0,0 +1,78 @@
+basename=eng-nld
+pkgname=dict-freedict-$basename
+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
+}