diff options
author | tuberry | 2020-11-18 14:27:28 +0800 |
---|---|---|
committer | tuberry | 2020-11-18 14:27:28 +0800 |
commit | 124015e2c9b45b0d2743425e35a74735d33688fd (patch) | |
tree | aae316c70d009ea3b484dee4673227386fc56526 | |
download | aur-124015e2c9b45b0d2743425e35a74735d33688fd.tar.gz |
change pkgname
-rw-r--r-- | .SRCINFO | 21 | ||||
-rw-r--r-- | PKGBUILD | 43 | ||||
-rw-r--r-- | dict-ecdict-git.install | 80 |
3 files changed, 144 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7e129389d8f8 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,21 @@ +pkgbase = dict-ecdict-git + pkgdesc = A port of Ultimate ECDICT database for dictd et al. + pkgver = 1.0.0.r6.6594129 + pkgrel = 1 + url = https://github.com/skywind3000/ECDICT-ultimate + install = dict-ecdict-git.install + arch = any + license = MIT + makedepends = dictd + makedepends = git + makedepends = curl + makedepends = python + makedepends = unzip + optdepends = dictd: dict client and server + provides = dict-ecdict + conflicts = dict-ecdict + source = git+https://github.com/tuberry/dict-ecdict + sha512sums = SKIP + +pkgname = dict-ecdict-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..4e69ab26d920 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,43 @@ +# Maintainer: tuberry + +_upstream='skywind3000/ECDICT-ultimate' +_srcname=dict-ecdict +pkgname=dict-ecdict-git +pkgver=1.0.0.r6.6594129 +pkgrel=1 +pkgdesc="A port of Ultimate ECDICT database for dictd et al." +arch=('any') +url="https://github.com/${_upstream}" +license=('MIT') +optdepends=('dictd: dict client and server') +makedepends=('dictd' 'git' 'curl' 'python' 'unzip') +provides=('dict-ecdict') +conflicts=('dict-ecdict') +install=${pkgname}.install +source=("git+https://github.com/tuberry/${_srcname}") +sha512sums=('SKIP') + +_get_latest_release() +{ # from -- https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c + curl --silent "https://api.github.com/repos/$1/releases/latest" | + grep '"tag_name":' | + sed -E 's/.*"([^"]+)".*/\1/' +} + +pkgver() +{ + cd ${_srcname} + printf "%s.r%s.%s" \ + "$( _get_latest_release ${_upstream} )" \ + "$( git rev-list --count HEAD )" \ + "$( git rev-parse --short HEAD )" +} + + +package() +{ + cd ${_srcname} + make VERSION=$( _get_latest_release ${_upstream} ) DESTDIR=${pkgdir} install + + install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${_srcname}/LICENSE +} diff --git a/dict-ecdict-git.install b/dict-ecdict-git.install new file mode 100644 index 000000000000..1f841760fd1d --- /dev/null +++ b/dict-ecdict-git.install @@ -0,0 +1,80 @@ +# steal from dict-freedict-*s + +basename=ecdict +pkgname=dict-$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 +} |