summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorinventor5002022-09-05 07:42:43 -0500
committerinventor5002022-09-05 07:42:43 -0500
commit20261042f82c1d5e6d8a803e629641c813c24a2d (patch)
tree5c897abfe068a73a00bbb3e2e8cce9bd9451e87b
parent08222bdb243e1c67b16e1b5cbdb0c89a17e133d2 (diff)
downloadaur-20261042f82c1d5e6d8a803e629641c813c24a2d.tar.gz
Added install file
-rw-r--r--.SRCINFO1
-rw-r--r--PKGBUILD1
-rw-r--r--dict-freedict-eng-jpn.install50
3 files changed, 52 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c286db992743..1b13cdcb4dbc 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -3,6 +3,7 @@ pkgbase = dict-freedict-eng-jpn
pkgver = 0.06
pkgrel = 2022.04
url = https://freedict.org
+ install = dict-freedict-eng-jpn.install
arch = any
license = CCPL
makedepends = dictd
diff --git a/PKGBUILD b/PKGBUILD
index f390bf9f4aa6..000c931d0055 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,6 +9,7 @@ url="https://freedict.org"
license=('CCPL')
optdepends=('dictd: dict client and server')
makedepends=('dictd')
+install=${pkgname}.install
source=('https://download.freedict.org/dictionaries/eng-jpn/2022.04.06/freedict-eng-jpn-2022.04.06.dictd.tar.xz')
sha512sums=('c7849529338ece587ae99cadd33fa8408be9a7c6bf16365efaf2aba644255a28482326c90869946613623df5f78e7b793afd3aea68b4ce9a3b9b36c76856bbf8')
diff --git a/dict-freedict-eng-jpn.install b/dict-freedict-eng-jpn.install
new file mode 100644
index 000000000000..cc9d5fda4ccc
--- /dev/null
+++ b/dict-freedict-eng-jpn.install
@@ -0,0 +1,50 @@
+basename=eng-jpn
+pkgname=dict-freedict-$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() {
+ 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
+
+ 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
+}
+
+post_upgrade() {
+ echo "Please restart dictd."
+}
+
+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
+ fi
+}