diff options
author | Einhard Leichtfuß | 2018-03-31 01:14:24 +0200 |
---|---|---|
committer | Einhard Leichtfuß | 2018-03-31 22:38:43 +0200 |
commit | 8b5ade22fad447e739d3da87e0788ad00684f026 (patch) | |
tree | 3c23733cc87a226818104e9cf1a2e930fad846c6 | |
download | aur-8b5ade22fad447e739d3da87e0788ad00684f026.tar.gz |
Initial commit
Establish a properly named binary replacement for dict-freedict-fra-deu,
now being based on sources.
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | PKGBUILD | 32 | ||||
-rw-r--r-- | dict-freedict-fra-deu-bin.install | 78 |
3 files changed, 126 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..32b33ca03279 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = dict-freedict-fra-deu-bin + pkgdesc = French -> German dictionary for dictd et al. from Freedict.org + pkgver = 2017_11_24 + pkgrel = 1 + url = http://www.freedict.org/ + install = dict-freedict-fra-deu-bin.install + arch = any + license = GPL + optdepends = dictd: dict client and server + provides = dict-freedict-fra-deu + conflicts = dict-freedict-fra-deu + source = https://sourceforge.net/projects/freedict/files/fra-deu/2017-11-24/freedict-fra-deu-2017-11-24.dictd.tar.xz + sha512sums = b5ccc967c0400d75bba4ab18d651cdac9ca7e9edf5e2673c819ef652fce0fc01aac6047806362a6aa31501ebf2ba864c04fc46e42d8976e77678c00f8fee3925 + +pkgname = dict-freedict-fra-deu-bin + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..89c0b43d95c8 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,32 @@ +# Maintainer: Einhard Leichtfuß <alguien@respiranto.de> +_lang=fra-deu +_pkgname=dict-freedict-${_lang} +pkgname=${_pkgname}-bin +pkgver=2017_11_24 +_pkgver=${pkgver//_/-} +pkgrel=1 +pkgdesc="French -> German dictionary for dictd et al. from Freedict.org" +arch=('any') +url="http://www.freedict.org/" +license=('GPL') +optdepends=('dictd: dict client and server') +provides=(${_pkgname}) +conflicts=(${_pkgname}) +install=${pkgname}.install +source=("https://sourceforge.net/projects/freedict/files/${_lang}/${_pkgver}/freedict-${_lang}-${_pkgver}.dictd.tar.xz") +sha512sums=('b5ccc967c0400d75bba4ab18d651cdac9ca7e9edf5e2673c819ef652fce0fc01aac6047806362a6aa31501ebf2ba864c04fc46e42d8976e77678c00f8fee3925') + +package() +{ + install -m 755 -d "${pkgdir}/usr/share/dictd" + install -m 644 -t "${pkgdir}/usr/share/dictd/" \ + ${_lang}/${_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-fra-deu-bin.install b/dict-freedict-fra-deu-bin.install new file mode 100644 index 000000000000..d17b1bddcdb9 --- /dev/null +++ b/dict-freedict-fra-deu-bin.install @@ -0,0 +1,78 @@ +basename=fra-deu +pkgname=dict-freedict-$basename-bin +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 +} |