summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEinhard Leichtfuß2018-03-31 01:14:24 +0200
committerEinhard Leichtfuß2018-03-31 22:38:38 +0200
commitb8fb07945b15e7d1c51dd0dee44d087c8c47e443 (patch)
treeea55799f98e19e37b748d966c8fcc4834163e845
downloadaur-b8fb07945b15e7d1c51dd0dee44d087c8c47e443.tar.gz
Initial commit
Establish a properly named binary replacement for dict-freedict-eng-fra, now being based on sources.
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD32
-rw-r--r--dict-freedict-eng-fra-bin.install78
3 files changed, 126 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..266b8d81ee90
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = dict-freedict-eng-fra-bin
+ pkgdesc = English -> French dictionary for dictd et al. from Freedict.org
+ pkgver = 0.1.6
+ pkgrel = 1
+ url = http://www.freedict.org/
+ install = dict-freedict-eng-fra-bin.install
+ arch = any
+ license = GPL
+ optdepends = dictd: dict client and server
+ provides = dict-freedict-eng-fra
+ conflicts = dict-freedict-eng-fra
+ source = https://sourceforge.net/projects/freedict/files/eng-fra/0.1.6/freedict-eng-fra-0.1.6.dictd.tar.xz
+ sha512sums = 51e2f5734249bf519e3f5efa265fa809708c903fdc299d80d36f5b1c088f8f144c6d47e6fcb3265570e11a93eb45c378085b116a11e2209d21e93c8942762414
+
+pkgname = dict-freedict-eng-fra-bin
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..326a8bdc9672
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
+# Contributor: Benjamin Vanderford <hazor_at_swrpg_dot_info>
+_lang=eng-fra
+_pkgname=dict-freedict-${_lang}
+pkgname=${_pkgname}-bin
+pkgver=0.1.6
+pkgrel=1
+pkgdesc="English -> French 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=('51e2f5734249bf519e3f5efa265fa809708c903fdc299d80d36f5b1c088f8f144c6d47e6fcb3265570e11a93eb45c378085b116a11e2209d21e93c8942762414')
+
+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-fra-bin.install b/dict-freedict-eng-fra-bin.install
new file mode 100644
index 000000000000..5607f60d4447
--- /dev/null
+++ b/dict-freedict-eng-fra-bin.install
@@ -0,0 +1,78 @@
+basename=eng-fra
+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
+}