~sircmpwn/alpine-aports (mirror)

testing/dictd: new aport v4 PROPOSED

Ngô Ngọc Đức Huy: 1
 testing/dictd: new aport

 5 files changed, 169 insertions(+), 0 deletions(-)
This merge request has been superseded by another (22132).

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/22132
mailinglist-bot
huyngo@disroot.org replied via email:

```
This merge request has been superseded by another (22132).

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/22132

```

-- 
via https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/21866#note_165227
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/alpine-aports/patches/23090/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH v4] testing/dictd: new aport Export this patch

https://sourceforge.net/projects/dict/
Client/server software and tools supporting DICT protocol (RFC 2229)
---
 testing/dictd/APKBUILD     | 37 ++++++++++++++++++
 testing/dictd/colorit.conf | 32 +++++++++++++++
 testing/dictd/dict.conf    |  6 +++
 testing/dictd/dictd.conf   | 14 +++++++
 testing/dictd/dictd.initd  | 80 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 169 insertions(+)
 create mode 100644 testing/dictd/APKBUILD
 create mode 100644 testing/dictd/colorit.conf
 create mode 100644 testing/dictd/dict.conf
 create mode 100644 testing/dictd/dictd.conf
 create mode 100644 testing/dictd/dictd.initd

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 $?
}
-- 
2.31.1
algitbot
Sorry to bother you @mailinglist-bot,

but we've detected that this merge request hasn't seen any recent activity. If you need help or want to discuss your approach with developers you can ping `@team/mentors`. You can also ask on IRC on `#alpine-devel` on irc.oftc.net. If no further activity occurs in this MR, Alpine developers may close it in the future.

Thanks for your contribution.

-- 
via https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/21866#note_165220