aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2021-05-30 15:39:02 +0700
committerdispatch <dispatch@listserv.local>2021-05-30 08:40:22 +0000
commit5ffad837cfbe14a4fe02208d071b206295a2d7be (patch)
tree19b0e8cd317cae66855ba6954444f0e67b51a288
parent2b0f309169385ca018576095dd329e2d447324eb (diff)
downloadaports-patches/3535.tar.gz
aports-patches/3535.tar.bz2
aports-patches/3535.tar.xz
testing/dictd: new aportpatches/3535
https://sourceforge.net/projects/dict/ Client/server software and tools supporting DICT protocol (RFC 2229)
-rw-r--r--testing/dictd/APKBUILD37
-rw-r--r--testing/dictd/colorit.conf32
-rw-r--r--testing/dictd/dict.conf6
-rw-r--r--testing/dictd/dictd.conf14
-rw-r--r--testing/dictd/dictd.initd80
5 files changed, 169 insertions, 0 deletions
diff --git a/testing/dictd/APKBUILD b/testing/dictd/APKBUILD
new file mode 100644
index 0000000000..ff6911de6c
--- /dev/null
+++ b/testing/dictd/APKBUILD
@@ -0,0 +1,37 @@
+# Maintainer: Ngô Ngọc Đức Huy <huyngo@disroot.org>
+pkgname=dictd
+pkgver=1.13.0
+pkgrel=9
+pkgdesc="Client/server software and tools for the DICT protocol (RFC 2229)"
+url="https://sourceforge.net/projects/dict/"
+arch="all"
+license="GPL-2.0-only"
+depends="gawk m4"
+makedepends="zlib-dev libmaa-dev libtool byacc flex"
+subpackages="$pkgname-doc"
+source="https://downloads.sourceforge.net/dict/dictd-$pkgver.tar.gz
+ dictd.conf
+ dict.conf
+ colorit.conf
+ dictd.initd"
+options="libtool"
+
+build() {
+ ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin
+ make
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+ install -Dm644 $srcdir/dictd.conf "$pkgdir"/etc/dictd.conf
+ install -Dm644 $srcdir/dict.conf "$pkgdir"/etc/dict.conf
+ install -Dm644 $srcdir/colorit.conf "$pkgdir"/etc/colorit.conf
+ install -Dm774 $srcdir/dictd.initd "$pkgdir"/etc/init.d/dictd
+}
+sha512sums="
+86871aaf34a182d1d7aac1a1282d4a75f2d7c112c762e92f303924c324f665dae75c51e7ca91e3cc1dde2053ad8e2d1fd50a76934a5f84ff70975aa858e26439 dictd-1.13.0.tar.gz
+8c750aa43e614de9da83fd47644b96050cb9d0678689f5b13d4ab65b10e009c260ac400deb20f35acaaef373fb5d4ad236bec6f103f93ecd1462e67aee51dbd7 dictd.conf
+22fbfd3bf8c4f88801aab848e160f46bf17757086ffe8fe7a4cdb78f983e88f6c923cac8714f78d31ab311957aa860731f663324b742febd0a5039085672aeb5 dict.conf
+5df19904f25f482b4b4c90c26279ba8e8747ecf6a0f0045e456613891bc8447f1ee150d51ab3f36a5f8f8f967a07169dbfda2a6743abb842f6ed1d3fd7f88411 colorit.conf
+b3598b8ffe3f38703abcfd9a775b98b0485cb70aeb72fb787d008d356f8a32127244e1d113580f69ba3a6aed5a24bb35807a46f6285a58179994664854e2b9d1 dictd.initd
+"
diff --git a/testing/dictd/colorit.conf b/testing/dictd/colorit.conf
new file mode 100644
index 0000000000..8355dae158
--- /dev/null
+++ b/testing/dictd/colorit.conf
@@ -0,0 +1,32 @@
+dnl /etc/dictd/colorit.conf vim:ft=m4
+dnl
+dnl Sample configuration file for colorit(1) program
+dnl
+divert(-1)
+dnl
+dnl Define some useful color variables
+dnl
+define(`black', `0')
+define(`red', `1')
+define(`green', `2')
+define(`brown', `3')
+define(`blue', `4')
+define(`magenta', `5')
+define(`cyan', `6')
+define(`white', `7')
+dnl
+dnl Mark macro arguments: regexp foreground-color [background-color]
+dnl
+define(`mark', ``mark "$1"'' `ifelse(`$#', `3', ``"\033[3$2;4$3m"'', ``"\033[3$2m"'')' `"\033[m"')
+dnl
+divert
+mark(`^From.*$',red,cyan)
+mark(`^ [^ ]+',green)
+mark(`^ *Note:',red)
+mark(`{[^{]+}',green)
+mark(`^ *\[[^\[]+\]', cyan)
+mark(`^[ ]*(adj|n|v|adv)? *[0-9]+[\.:]',cyan)
+mark(`^ *\([a-z]+\)',cyan)
+mark(`(Syn|Ant|syn|ant):', blue, white)
+mark(` (t|i|a|adj|adv|n|v)\. ',cyan)
+mark(` (t|i|a|adj|adv|n|v)\.$',cyan)
diff --git a/testing/dictd/dict.conf b/testing/dictd/dict.conf
new file mode 100644
index 0000000000..e06c3d296e
--- /dev/null
+++ b/testing/dictd/dict.conf
@@ -0,0 +1,6 @@
+# This is the configuration file for dict.
+# Usually all you will ever need here is the server keywords.
+# Refer to the dict manpage for other options.
+# It will only check the second server if the first fails
+server localhost
+server dict.org
diff --git a/testing/dictd/dictd.conf b/testing/dictd/dictd.conf
new file mode 100644
index 0000000000..2818eaed2a
--- /dev/null
+++ b/testing/dictd/dictd.conf
@@ -0,0 +1,14 @@
+# dictd configuration file.
+# whipped up by michael conrad tilstra <michael@gentoo.org>
+
+# Informational message
+
+global {
+}
+
+# who's allowed. You might want to change this.
+access {
+ allow *
+}
+
+# List your dictionary databases below.
diff --git a/testing/dictd/dictd.initd b/testing/dictd/dictd.initd
new file mode 100644
index 0000000000..78b704267d
--- /dev/null
+++ b/testing/dictd/dictd.initd
@@ -0,0 +1,80 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Copyright 2021 Ngô Ngọc Đức Huy
+# Distributed under the terms of the GNU General Public License v2
+
+DICTD_PID="/var/run/dictd.pid"
+DICTDCONF="/etc"
+DLIBDIR="/usr/share/dict"
+
+prepconfig() {
+ local TMPCONF INDEXFILES CNT DNAME DICT SAVEDIR
+ if [ ! -e "${DICTDCONF}" ]; then
+ eerror "Config file ${DICTDCONF} not found."
+ return 1
+ fi
+
+ # if no dictionaries, skip startup.
+ # The new way of doing this is to scan /usr/lib/dict and tweek the conf
+ einfo "Scanning for dictionaries..."
+ if [ ! -d "${DLIBDIR}" ]; then
+ eerror "${DLIBDIR} doesn't exist, no dictionaries found."
+ return 1
+ fi
+
+ SAVEDIR=${PWD}
+ cd "${DLIBDIR}"
+ INDEXFILES=$(ls *.index)
+ if [ -z "${INDEXFILES}" ]; then
+ eerror "No dictionaries found at ${DLIBDIR}."
+ eerror "Please, emerge at least one of app-dicts/dictd-* dictionaries."
+ return 1
+ fi
+
+ TMPCONF=$(mktemp -t dictd.conf.XXXXXXXXXX)
+ cat ${DICTDCONF} | sed -e '/^#LASTLINE/,$d' > ${TMPCONF}
+ echo "#LASTLINE" >> ${TMPCONF}
+
+ CNT=0
+ for i in ${INDEXFILES}; do
+ DNAME=$(echo $i | sed -e 's/[.]index$//')
+ #two possible names for a matching dictionary, check which is there.
+ if [ -f ${DNAME}.dict.dz ]; then
+ DICT=${DNAME}.dict.dz
+ elif [ -f ${DNAME}.dict ];then
+ DICT=${DNAME}.dict
+ else
+ ewarn "Index $i has no matching dictionaray..."
+ fi
+
+ #ok, go an index, and a dixtionary, append.
+ echo "database ${DNAME} { data \"${DLIBDIR}/${DICT}\"" >> ${TMPCONF}
+ echo " index \"${DLIBDIR}/$i\" }" >> ${TMPCONF}
+
+ CNT=$(expr ${CNT} + 1)
+ done
+
+ cd "${SAVEDIR}"
+ mv "${TMPCONF}" "${DICTDCONF}"
+ chown 0:dictd "${DICTDCONF}"
+ chmod g+r "${DICTDCONF}"
+ einfo "Done, ${CNT} dictionaries found."
+}
+
+depend() {
+ need localmount
+}
+
+start() {
+ prepconfig || return 1
+ ebegin "Starting dictd"
+ start-stop-daemon --start --quiet --pidfile ${DICTD_PID} --exec \
+ /usr/sbin/dictd -- --pid-file ${DICTD_PID} ${DICTD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping dictd"
+ start-stop-daemon --stop --quiet --pidfile ${DICTD_PID} --exec /usr/sbin/dictd
+ eend $?
+}