summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEinhard Leichtfuß2018-03-31 01:14:17 +0200
committerEinhard Leichtfuß2018-03-31 22:38:29 +0200
commit9f891efa75e75f1f11e421918864f732542bc6d4 (patch)
tree1fe90af5a14e9bcd5f90810e446794e6e2187eb7
downloadaur-9f891efa75e75f1f11e421918864f732542bc6d4.tar.gz
Initial commit
Establish a properly named binary replacement for dict-freedict-deu-eng, now being based on sources.
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD32
-rw-r--r--dict-freedict-deu-eng-bin.install78
3 files changed, 126 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..764acc897296
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = dict-freedict-deu-eng-bin
+ pkgdesc = German -> English dictionary for dictd et al. from Freedict.org
+ pkgver = 0.3.5
+ pkgrel = 1
+ url = http://www.freedict.org/
+ install = dict-freedict-deu-eng-bin.install
+ arch = any
+ license = GPL
+ optdepends = dictd: dict client and server
+ provides = dict-freedict-deu-eng
+ conflicts = dict-freedict-deu-eng
+ source = https://sourceforge.net/projects/freedict/files/deu-eng/0.3.5/freedict-deu-eng-0.3.5.dictd.tar.xz
+ sha512sums = e6a57068afd6c3d6b0e5130e9c232bbaf9212250cdd0ee17f934852ab656f56c7e0c20168801e1df1632a1b8814a93ca74e8e483a51349cd36e0031939768985
+
+pkgname = dict-freedict-deu-eng-bin
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..2946ce089641
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
+# Contributor: akane <grangerspit@gmail.com> <xmpp:heiß@neko.im>
+_lang=deu-eng
+_pkgname=dict-freedict-${_lang}
+pkgname=${_pkgname}-bin
+pkgver=0.3.5
+pkgrel=1
+pkgdesc="German -> English 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=('e6a57068afd6c3d6b0e5130e9c232bbaf9212250cdd0ee17f934852ab656f56c7e0c20168801e1df1632a1b8814a93ca74e8e483a51349cd36e0031939768985')
+
+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-deu-eng-bin.install b/dict-freedict-deu-eng-bin.install
new file mode 100644
index 000000000000..68a75061e33d
--- /dev/null
+++ b/dict-freedict-deu-eng-bin.install
@@ -0,0 +1,78 @@
+basename=deu-eng
+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
+}