summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorriderius2024-04-10 14:14:06 +0300
committerriderius2024-04-10 14:14:06 +0300
commit5d79eb8ec5125eb0dc42fe6af5c2f8508105b628 (patch)
tree4b9590b3deae88d65398e0f3b873a442349e8372
downloadaur-5d79eb8ec5125eb0dc42fe6af5c2f8508105b628.tar.gz
Initial upload: dict-ozhegov 1.0-1
Signed-off-by: riderius <riderius.help@gmail.com>
-rw-r--r--.SRCINFO16
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD28
-rw-r--r--dict-ozhegov.install78
4 files changed, 126 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..fa36e1f5bd6a
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = dict-ozhegov
+ pkgdesc = Ozhegov's Russian Dictionary
+ pkgver = 1.0
+ pkgrel = 1
+ install = dict-ozhegov.install
+ arch = any
+ license = unknown
+ makedepends = python3
+ makedepends = dictd
+ optdepends = dictd: dict client and server
+ provides = dictd-ozhegov
+ conflicts = dictd-ozhegov
+ source = dict-ozhegov::git+https://github.com/Layerex/ozhegov-dict.git#commit=4a5876473a935da5e33852bc3360fccc798255e0
+ sha256sums = SKIP
+
+pkgname = dict-ozhegov
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..0558f7474a56
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+pkg
+src
+*.zst
+dict-ozhegov/
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..fdfcfb0d50cc
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,28 @@
+# Maintainer: Riderius <riderius.help@gmail.com>
+
+pkgname=dict-ozhegov
+pkgver=1.0
+pkgrel=1
+pkgdesc="Ozhegov's Russian Dictionary"
+arch=('any')
+license=('unknown')
+optdepends=('dictd: dict client and server')
+makedepends=('python3' 'dictd')
+provides=('dictd-ozhegov')
+conflicts=('dictd-ozhegov')
+# Install file from dict-gcide (https://aur.archlinux.org/cgit/aur.git/tree/dict-gcide.install?h=dict-gcide)
+install="${pkgname}.install"
+source=("${pkgname}::git+https://github.com/Layerex/ozhegov-dict.git#commit=4a5876473a935da5e33852bc3360fccc798255e0")
+sha256sums=('SKIP')
+
+prepare() {
+ cd "${srcdir}/${pkgname}"
+ python ozhegov-parse.py ozhegov.txt | dictfmt --utf8 --allchars -s "Словарь Ожегова" -u "https://github.com/Layerex/ozhegov-dict" -j ozhegov
+ dictzip ozhegov.dict
+}
+
+package() {
+ cd "${srcdir}/${pkgname}"
+ install -m 0755 -d "${pkgdir}/usr/share/dictd"
+ install -m 0644 -t "${pkgdir}/usr/share/dictd/" ozhegov.{dict.dz,index}
+}
diff --git a/dict-ozhegov.install b/dict-ozhegov.install
new file mode 100644
index 000000000000..6f57c24dbd9c
--- /dev/null
+++ b/dict-ozhegov.install
@@ -0,0 +1,78 @@
+pkgname=dict-ozhegov
+basename=ozhegov
+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
+}