diff options
author | Lennard Hofmann | 2020-04-30 18:14:29 +0200 |
---|---|---|
committer | Lennard Hofmann | 2020-04-30 18:16:06 +0200 |
commit | 179b9711f88e8c70bcb40937534b4bf8c378e20c (patch) | |
tree | 4d79cb9447f03e627e182ffac11d1001f2892108 | |
download | aur-dict-freedict-lat-deu.tar.gz |
Copied from dict-freedict-eng-deu and modified
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | PKGBUILD | 35 | ||||
-rw-r--r-- | dict-freedict-lat-deu.install | 78 |
3 files changed, 129 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2680c8bc1ec1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = dict-freedict-lat-deu + pkgdesc = Latin -> German dictionary for dictd et al. from Freedict.org + pkgver = 1.0.3 + pkgrel = 1 + url = https://freedict.org/ + install = dict-freedict-lat-deu.install + arch = any + license = GPL + makedepends = dictd + makedepends = freedict-tools + optdepends = dictd: dict client and server + source = https://download.freedict.org/dictionaries/lat-deu/1.0.3/freedict-lat-deu-1.0.3.src.tar.xz + sha512sums = 8901f65f339a23d07dbfff86403f87599847fcf8611abfbf3feb36b7809cafef52c969a5b758ff6cf9635496d223a3d8430e5a93266fb3e73cc2f93684d12625 + +pkgname = dict-freedict-lat-deu + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..12140c5e3208 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,35 @@ +# Maintainer: Lennard Hofmann <lennard dot hofmann at web dot de> +_lang=lat-deu +pkgname=dict-freedict-${_lang} +pkgver=1.0.3 +pkgrel=1 +pkgdesc="Latin -> German dictionary for dictd et al. from Freedict.org" +arch=('any') +url="https://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=('8901f65f339a23d07dbfff86403f87599847fcf8611abfbf3feb36b7809cafef52c969a5b758ff6cf9635496d223a3d8430e5a93266fb3e73cc2f93684d12625') + +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-lat-deu.install b/dict-freedict-lat-deu.install new file mode 100644 index 000000000000..5fa9f774f241 --- /dev/null +++ b/dict-freedict-lat-deu.install @@ -0,0 +1,78 @@ +basename=lat-deu +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 +} |