summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEinhard Leichtfuß2018-03-31 01:14:24 +0200
committerEinhard Leichtfuß2018-03-31 22:38:42 +0200
commit46ba6ba71dda5bcaad436c8864774b374bbe9052 (patch)
tree2d6a5c088375ee777dfcf6d1d262f4e58c478e16
downloadaur-46ba6ba71dda5bcaad436c8864774b374bbe9052.tar.gz
Initial commit
Establish a properly named binary replacement for dict-freedict-eng-spa, now being based on sources.
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD31
-rw-r--r--dict-freedict-eng-spa-bin.install78
3 files changed, 125 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..3dbfce826590
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = dict-freedict-eng-spa-bin
+ pkgdesc = English -> Spanish dictionary for dictd et al. from Freedict.org
+ pkgver = 0.3
+ pkgrel = 1
+ url = http://www.freedict.org/
+ install = dict-freedict-eng-spa-bin.install
+ arch = any
+ license = GPL
+ optdepends = dictd: dict client and server
+ provides = dict-freedict-eng-spa
+ conflicts = dict-freedict-eng-spa
+ source = https://sourceforge.net/projects/freedict/files/eng-spa/0.3/freedict-eng-spa-0.3.dictd.tar.xz
+ sha512sums = 1ccf9b4aa09a826a4a56830fcf416b00250e2919ec6e0ce83e3fafb17e21e94e3a7e262699e6616287cef6f25c1c18994efd663fd0ae46bca5bec405fd769d2a
+
+pkgname = dict-freedict-eng-spa-bin
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..e9d83be5a879
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,31 @@
+# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
+_lang=eng-spa
+_pkgname=dict-freedict-${_lang}
+pkgname=${_pkgname}-bin
+pkgver=0.3
+pkgrel=1
+pkgdesc="English -> Spanish 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=('1ccf9b4aa09a826a4a56830fcf416b00250e2919ec6e0ce83e3fafb17e21e94e3a7e262699e6616287cef6f25c1c18994efd663fd0ae46bca5bec405fd769d2a')
+
+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-eng-spa-bin.install b/dict-freedict-eng-spa-bin.install
new file mode 100644
index 000000000000..767eb84cb816
--- /dev/null
+++ b/dict-freedict-eng-spa-bin.install
@@ -0,0 +1,78 @@
+basename=eng-spa
+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
+}