Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 78DBD782C23 for ; Tue, 8 Jun 2021 13:11:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id B4C035BDC7; Tue, 8 Jun 2021 15:11:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hwja6bliCHNG; Tue, 8 Jun 2021 15:11:07 +0200 (CEST) From: =?UTF-8?q?Ng=C3=B4=20Ng=E1=BB=8Dc=20=C4=90=E1=BB=A9c=20Huy?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1623157867; bh=w4WmaKqwUU2QMJg41wpcutWP3iWc41cxHdHGz4Ge7GY=; h=From:To:Cc:Subject:Date; b=RpH1Pg0m4LMCOPav9ETot7XH7RuVcLrAichIcoqdS4kEEK7U6jH6+izXRtXhBJIjk R+BpEOymiAIESW9mxUzOviowDXSrYP/RoTVhlk01kLhrpDYpbIT8o6WiicpgeIYTnd X60JmVNJSmd64w4lfspdTMVeuPUUwQk+kwStNAu1Jj+6iNO8UmZNVHW2xGfauXS3Ub gH1hf+WGHbTguxomO3cG9vYL77Y5sSyF+NecvgEi56UTt1feWFy7JHYJUiJTsJwxpM ppnuUrqhIqrLarAA0FSn/xNDK5Cxzzai44Dy6+W5cLYSllpdYkf95awdUFmeBGb0D2 BIJ763AsKy/tw== To: alpine-aports@lists.alpinelinux.org Cc: =?UTF-8?q?Ng=C3=B4=20Ng=E1=BB=8Dc=20=C4=90=E1=BB=A9c=20Huy?= Subject: [PATCH v5] testing/dictd: new aport Date: Tue, 8 Jun 2021 20:10:14 +0700 Message-Id: <20210608131014.10389-1-huyngo@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sourceforge.net/projects/dict/ Client/server software and tools supporting DICT protocol (RFC 2229) --- testing/dictd/APKBUILD | 36 +++++++++++++++++ testing/dictd/colorit.conf | 32 +++++++++++++++ testing/dictd/dict.conf | 6 +++ testing/dictd/dictd.conf | 14 +++++++ testing/dictd/dictd.initd | 80 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 168 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..625298f294 --- /dev/null +++ b/testing/dictd/APKBUILD @@ -0,0 +1,36 @@ +# Maintainer: Ngô Ngọc Đức Huy +pkgname=dictd +pkgver=1.13.0 +pkgrel=10 +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" + +build() { + ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --build=$CBUILD --host=$CHOST + 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 + +# 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.32.0