summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEinhard Leichtfuß2017-04-11 20:15:20 +0200
committerEinhard Leichtfuß2017-04-11 20:15:20 +0200
commit442e66ece56e8ff2a5c8ce2dd713e3ccf4497415 (patch)
tree079d3b711de65bc5e5aa568b6d97c3e52ab5d15f
downloadaur-442e66ece56e8ff2a5c8ce2dd713e3ccf4497415.tar.gz
Initial upload
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD45
-rw-r--r--dict-devils.install78
3 files changed, 141 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..58de6a4e9f4e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = dict-devils
+ pkgdesc = The Devil's Dictionary by Ambrose Bierce for dictd et al.
+ pkgver = 1
+ pkgrel = 1
+ url = http://wiretap.area.com/
+ install = dict-devils.install
+ arch = any
+ license = custom: Public Domain
+ makedepends = dictd
+ optdepends = dictd: dict client and server
+ conflicts = dictd-devils
+ source = http://wiretap.area.com/Gopher/Library/Classic/devils.txt
+ source = http://http.debian.net/debian/pool/main/d/dict-devil/dict-devil_1.0-12.debian.tar.gz
+ sha512sums = a48631d40696bf7ebf0a30f464e1ddaccf5971aadf67c2e224bfbbff4c74f75cd68b322b8d1f9c658812590b8bccddf12217aa1a6aef30ce32a92b25c20998cb
+ sha512sums = 7156a48738dcae73c33f36924cc77523c36b0e2fc066793e96d94bd6efca1aaa9c77a62ba988feedaef8488c4269fc785d58b2f17dc5758cfec3bf3f4b1736db
+
+pkgname = dict-devils
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ca30ca0c3939
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,45 @@
+# Maintainer: Einhard Leichtfuß <archer@respiranto.de>
+pkgname=dict-devils
+pkgver=1
+_debver=${pkgver}-12
+pkgrel=1
+pkgdesc="The Devil's Dictionary by Ambrose Bierce for dictd et al."
+arch=('any')
+url="http://wiretap.area.com/"
+license=('custom: Public Domain')
+optdepends=('dictd: dict client and server')
+makedepends=('dictd')
+conflicts=('dictd-devils')
+install=${pkgname}.install
+
+source=("http://wiretap.area.com/Gopher/Library/Classic/devils.txt"
+ "http://http.debian.net/debian/pool/main/d/dict-devil/dict-devil_1.0-12.debian.tar.gz")
+sha512sums=('a48631d40696bf7ebf0a30f464e1ddaccf5971aadf67c2e224bfbbff4c74f75cd68b322b8d1f9c658812590b8bccddf12217aa1a6aef30ce32a92b25c20998cb'
+ '7156a48738dcae73c33f36924cc77523c36b0e2fc066793e96d94bd6efca1aaa9c77a62ba988feedaef8488c4269fc785d58b2f17dc5758cfec3bf3f4b1736db')
+
+prepare()
+{
+ # Extract licensing statement.
+ grep -m1 -B1 'Public Domain' devils.txt > LICENSE
+
+ # "Convert" source from symbolic link to a regular file (necessary for
+ # patching).
+ cp --remove-destination "$(readlink devils.txt)" devils.txt
+
+ # Fix various typographical errors.
+ patch -p1 devils.txt debian/patches/debian-changes
+}
+
+build()
+{
+ debian/devil2dict devils.txt devils
+ dictzip devils.dict
+}
+
+package() {
+ install -m 0755 -d "${pkgdir}/usr/share/dictd"
+ install -m 0644 -t "${pkgdir}/usr/share/dictd/" devils.{dict.dz,index}
+
+ install -m 0755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m 0644 -t "${pkgdir}/usr/share/licenses/${pkgname}/" LICENSE
+}
diff --git a/dict-devils.install b/dict-devils.install
new file mode 100644
index 000000000000..c640ac35071e
--- /dev/null
+++ b/dict-devils.install
@@ -0,0 +1,78 @@
+basename=devils
+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
+}