diff options
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 35 | ||||
-rw-r--r-- | dict-freedict-nld-eng.install | 78 |
4 files changed, 130 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7fb7757802a5 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = dict-freedict-nld-eng + pkgdesc = Dutch -> English dictionary for dictd et al. from Freedict.org + pkgver = 0.2 + pkgrel = 1 + url = http://www.freedict.org/ + install = dict-freedict-nld-eng.install + arch = any + license = GPL + makedepends = dictd + makedepends = freedict-tools + optdepends = dictd: dict client and server + source = https://download.freedict.org/dictionaries/nld-eng/0.2/freedict-nld-eng-0.2.src.tar.xz + sha512sums = 23d938bcc48894b10c68bf4e3b769625f6fdc72d9deb12b46dff557079d1bea0d1847af7d375a92a78afdc10033e60904a8f55ce0dbcc6849d8ca6f63cd7dae2 + +pkgname = dict-freedict-nld-eng + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..b5624b74f804 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.tar.xz diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..5533f98410bb --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,35 @@ +# Maintainer: Bart De Roy <de dot roy dot bart at gmail dot com> +_lang=nld-eng +pkgname=dict-freedict-${_lang} +pkgver=0.2 +pkgrel=1 +pkgdesc="Dutch -> English 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=('23d938bcc48894b10c68bf4e3b769625f6fdc72d9deb12b46dff557079d1bea0d1847af7d375a92a78afdc10033e60904a8f55ce0dbcc6849d8ca6f63cd7dae2') + +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-nld-eng.install b/dict-freedict-nld-eng.install new file mode 100644 index 000000000000..261b90d76e43 --- /dev/null +++ b/dict-freedict-nld-eng.install @@ -0,0 +1,78 @@ +basename=nld-eng +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 +} |