summaryrefslogtreecommitdiff
path: root/community/dictd
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/dictd
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/dictd')
-rw-r--r--community/dictd/PKGBUILD46
-rw-r--r--community/dictd/dict.conf6
-rw-r--r--community/dictd/dictd92
-rw-r--r--community/dictd/dictd.conf25
-rw-r--r--community/dictd/dictd.confd7
-rw-r--r--community/dictd/dictd.xinetd12
-rw-r--r--community/dictd/site.info6
7 files changed, 194 insertions, 0 deletions
diff --git a/community/dictd/PKGBUILD b/community/dictd/PKGBUILD
new file mode 100644
index 000000000..4ccab18f5
--- /dev/null
+++ b/community/dictd/PKGBUILD
@@ -0,0 +1,46 @@
+# $Id: PKGBUILD 41057 2011-03-03 15:30:07Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: SmackleFunky <smacklefunky@optusnet.com.au>
+# Contributor: Enrico Morelli <morelli@cerm.unifi.it>
+
+pkgname=dictd
+pkgver=1.12.0
+pkgrel=1
+pkgdesc="Online dictionary client and server"
+url="http://sourceforge.net/projects/dict/"
+license=("GPL")
+arch=(i686 x86_64)
+depends=('zlib' 'libmaa')
+makedepends=('flex')
+backup=(etc/dict/dictd.conf
+ etc/dict/dict.conf
+ etc/dict/site.info
+ etc/conf.d/dictd
+ etc/xinetd.d/dictd)
+source=(http://downloads.sourceforge.net/project/dict/dictd/dictd-$pkgver/dictd-$pkgver.tar.gz
+ dictd
+ dict.conf
+ dictd.conf
+ dictd.confd
+ site.info
+ dictd.xinetd)
+md5sums=('71aaf3a697ea2e9409643f11ea85b53a'
+ '6542df4fc585773fc03f1a088730126b'
+ 'fb72f7d8c55f84b1b37bbc8d33a8e55a'
+ '64cd6ffdb40fb3367224f91ac44926ac'
+ '838887fee38ae4cebd652d399b1f2266'
+ 'b8cabf913876e544d919c7f20ff8db9e'
+ 'b7dbc9529df13ff895dae2b4abd080d6')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ ./configure --enable-dictorg --prefix=/usr --sysconfdir=/etc/dict
+ make
+ make DESTDIR=$pkgdir install
+ install -D -m 0755 $srcdir/dictd $pkgdir/etc/rc.d/dictd
+ install -D -m 0644 $srcdir/dictd.xinetd $pkgdir/etc/xinetd.d/dictd
+ install -D -m 0644 $srcdir/dictd.conf $pkgdir/etc/dict/dictd.conf
+ install -D -m 0644 $srcdir/dict.conf $pkgdir/etc/dict/dict.conf
+ install -D -m 0644 $srcdir/site.info $pkgdir/etc/dict/site.info
+ install -D -m 0644 $srcdir/dictd.confd $pkgdir/etc/conf.d/dictd
+}
diff --git a/community/dictd/dict.conf b/community/dictd/dict.conf
new file mode 100644
index 000000000..e06c3d296
--- /dev/null
+++ b/community/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/community/dictd/dictd b/community/dictd/dictd
new file mode 100644
index 000000000..4f435d6f0
--- /dev/null
+++ b/community/dictd/dictd
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+. /etc/conf.d/dictd
+. /etc/rc.conf
+
+. /etc/rc.d/functions
+
+preconfiguration() {
+ stat_busy "Check dictd configuration"
+ if [ ! -e ${DICTD_CONF} ]; then
+ echo "No configuration"
+ stat_fail
+ exit 1
+ fi
+ stat_done
+
+ # The new way of doing this is to scan /usr/lib/dict and tweek the conf
+ stat_busy "Scanning for dictionaries..."
+ if [ ! -d "${DICTD_DICTDIR}" ]; then
+ echo "No dictionaries found"
+ stat_fail
+ exit 1
+ fi
+ stat_done
+ pushd ${DICTD_DICTDIR} >/dev/null
+ INDEXFILES=`ls *.index`
+ if [ -z "$INDEXFILES" ]; then
+ echo "No dictionaries found"
+ stat_fail
+ exit 1
+ fi
+
+ cat $DICTD_CONF | sed -e '/^#LASTLINE/,$d' > $DICTD_TMPCONF
+ echo "#LASTLINE" >> $DICTD_TMPCONF
+
+ CNT=0
+ for i in $INDEXFILES
+ do
+ DNAME=`echo $i | awk -F . '{print $1;}'`
+ #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
+ echo "Index $i has no matching dictionaray..."
+ fi
+
+ #ok, go an index, and a dixtionary, append.
+ echo "database $DNAME { data \"${DICTD_DICTDIR}/${DICT}\"" >> $DICTD_TMPCONF
+ echo " index \"${DICTD_DICTDIR}/$i\" }" >> $DICTD_TMPCONF
+
+ CNT=`expr $CNT + 1`
+ done
+ popd >/dev/null
+ mv ${DICTD_TMPCONF} ${DICTD_CONF}
+ echo "$CNT dictionary indexes found."
+}
+
+PID=`pidof -o %PPID /usr/sbin/dictd`
+
+case "$1" in
+ start)
+ preconfiguration || exit 1
+ stat_busy "Start dictd daemon"
+ /usr/sbin/dictd $DICTD_ARGS -- $DICTD_EARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon dictd
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stop dictd daemon"
+ kill $PID 2>/dev/null 1>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon dictd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/community/dictd/dictd.conf b/community/dictd/dictd.conf
new file mode 100644
index 000000000..71e883a36
--- /dev/null
+++ b/community/dictd/dictd.conf
@@ -0,0 +1,25 @@
+# dictd configuration file.
+# whipped up by michael conrad tilstra <michael@gentoo.org>
+
+# Informational message
+
+global {
+ site site.info
+}
+
+# who's allowed. You might want to change this.
+access {
+ allow *
+}
+
+# Dictionaries are listed below.
+# The initrc script scans /usr/lib/dict and adds all of the dictionaries
+# it finds here.
+#
+# The initrc script will delete everything after the the last line and
+# replace it with what it finds. So add all of your things above.
+#
+# If this is a problem for people, contact me and
+# we can work out a different method.
+#
+#LASTLINE
diff --git a/community/dictd/dictd.confd b/community/dictd/dictd.confd
new file mode 100644
index 000000000..4b47dcdde
--- /dev/null
+++ b/community/dictd/dictd.confd
@@ -0,0 +1,7 @@
+# Config file for /etc/rc.d/dictd
+
+DICTD_CONF=/etc/dict/dictd.conf
+DICTD_DICTDIR=/usr/share/dictd
+DICTD_TMPCONF=/etc/dict/dictd.conf.$$
+DICTD_EARGS="-s"
+DICTD_ARGS="--locale en_US.UTF-8"
diff --git a/community/dictd/dictd.xinetd b/community/dictd/dictd.xinetd
new file mode 100644
index 000000000..a3e3773dc
--- /dev/null
+++ b/community/dictd/dictd.xinetd
@@ -0,0 +1,12 @@
+service dict
+{
+ disable = yes
+ type = UNLISTED
+ port = 2628
+ socket_type = stream
+ protocol = tcp
+ wait = no
+ user = daemon
+ server = /usr/sbin/dictd
+ server_args = -c /etc/dict/dictd.conf -i --locale en_US.UTF-8
+}
diff --git a/community/dictd/site.info b/community/dictd/site.info
new file mode 100644
index 000000000..23bfdeb61
--- /dev/null
+++ b/community/dictd/site.info
@@ -0,0 +1,6 @@
+Welcome to your dictionary server dictd!
+
+This is an example site information file. It should contain information
+about any restricted databases and how users can obtain access. If may
+also contain other random data as you see fit.
+