diff options
Diffstat (limited to 'app-text/dictd/files/1.9.11-r1/dictd')
-rw-r--r-- | app-text/dictd/files/1.9.11-r1/dictd | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/app-text/dictd/files/1.9.11-r1/dictd b/app-text/dictd/files/1.9.11-r1/dictd new file mode 100644 index 000000000000..1072ab1cf847 --- /dev/null +++ b/app-text/dictd/files/1.9.11-r1/dictd @@ -0,0 +1,72 @@ +#!/sbin/runscript +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/app-text/dictd/files/1.9.11-r1/dictd,v 1.1 2004/02/09 07:13:59 absinthe Exp $ + +# NB: Config is in /etc/conf.d/dictd + + +prepconfig() { + if [ ! -e ${DICTDCONF} ] + then + eerror "dictd not started. Config file 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 + pushd ${DLIBDIR} >/dev/null + INDEXFILES=`ls *.index` + if [ -z "$INDEXFILES" ]; then + eerror "No dictionaries installed." + return 1 + fi + + cat $DICTDCONF | sed -e '/^#LASTLINE/,$d' > $TMPCONF + echo "#LASTLINE" >> $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 + einfo "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 + popd >/dev/null + mv ${TMPCONF} ${DICTDCONF} + einfo "Done, $CNT dictionary indexes found." +} + +depend() { + need localmount +} + +start() { + ebegin "Starting dictd" + prepconfig || return 1 + start-stop-daemon --start --quiet --exec /usr/sbin/dictd -- $EARGS + eend $? +} + +stop() { + ebegin "Stopping dictd" + start-stop-daemon --stop --quiet --exec /usr/sbin/dictd + eend $? +} |