blob: 2bc09a6dee11d3824997871c9f57e89ffa68ae8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/sbin/runscript
# Copyright 1999-2002 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.5.5-r6/dictd.rc6,v 1.3 2001/12/06 20:17:01 azarah Exp $
EARGS="-s "
DICTDCONF=/etc/dict/dictd.conf
DLIBDIR=/usr/lib/dict
TMPCONF=/etc/dict/dictd.conf.$$
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 $?
}
|