Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 242623 Details for
Bug 332481
app-text/dictd init script rewrites /etc/dict/dictd.conf on every boot
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Revised /etc/init.d/dictd script
dictd (text/plain), 3.37 KB, created by
C W Rose
on 2010-08-12 16:22:08 UTC
(
hide
)
Description:
Revised /etc/init.d/dictd script
Filename:
MIME Type:
Creator:
C W Rose
Created:
2010-08-12 16:22:08 UTC
Size:
3.37 KB
patch
obsolete
>#!/sbin/runscript ># Copyright 1999-2004 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 ># $Header: /var/cvsroot/gentoo-x86/app-text/dictd/files/1.10.11/dictd.initd,v 1.4 2010/08/09 12:00:00 pva Exp $ > >DICTD_PID="/var/run/dictd.pid" > >prepconfig() { > > # If there is no configuration file, then quit. > if [ ! -e "${DICTDCONF}" ] > then > eerror "Config file ${DICTDCONF} not found." > return 1 > fi > > # If there is no directory for the dictionaries, then quit. > einfo "Scanning for dictionaries..." > if [ ! -d "${DLIBDIR}" ] > then > eerror "Directory ${DLIBDIR} not found." > return 1 > fi > > # Declare indexed arrays (apparently quicker). > local -a datafiles > local -a ifiles > local -a dfiles > local -a dzfiles > local COUNT TOTAL > > # Get a list of the databases already known to dictd. > datafiles=(`grep ^database ${DICTDCONF} | cut -s -d '"' -f 2`) > COUNT=${#datafiles[@]} > for ((i = 0 ; i < COUNT ; i++)) > do > # Remove any references to non-existent databases. > if [ ! -f ${datafiles[$i]} ] > then > sed -i -e "\@^data.*${datafiles[$i]}@,+1d" ${DICTDCONF} > fi > done > > # Get a list of the installed index files. > ifiles=( `ls ${DLIBDIR}/*index` ) > COUNT=${#ifiles[@]} > > # Generate the related dictionary names. > dfiles=( ${ifiles[@]/%index/dict} ) > dzfiles=( ${ifiles[@]/%index/dict.dz} ) > > # Check that all the available indices have an associated dictionary. > for ((i = 0 ; i < COUNT ; i++)) > do > if [ -f ${dfiles[$i]} ] > then > unset dzfiles[$i] > elif [ -f ${dzfiles[$i]} ] > then > unset dfiles[$i] > else > ewarn "Index ${ifiles[$i]} has no matching dictionary." > unset ifiles[$i] > unset dfiles[$i] > unset dzfiles[$i] > fi > done > > # If there are no valid index files left, quit. > if [[ ${#ifiles[@]} == 0 ]] > then > eerror "No valid dictionaries were found in ${DLIBDIR}." > eerror "Please emerge at least one of the app-dicts/dictd-* dictionaries." > unset datafiles > unset ifiles > unset dfiles > unset dzfiles > return 1 > fi > > # The standard output format is: > # database web1913 { data "/usr/lib/dict/web1913.dict.dz" > # index "/usr/lib/dict/web1913.index" } > # The first line must start at the right margin. > TOTAL=0 > for ((i = 0 ; i < COUNT ; i++)) > do > if [[ ${ifiles[$i]} == "" ]] > then > continue > fi > (( TOTAL += 1 )) > # Check for hitherto unknown index files. > if [[ `grep -c ${ifiles[$i]} ${DICTDCONF}` == 0 ]] > then > # If index and dictionary both exist, add them to dictd.conf > if [ ${dfiles[$i]} -a -f ${dfiles[$i]} ] > then > echo -e "database `basename ${ifiles[$i]} .index` { data \"${dfiles[$i]}\"\n index \"${ifiles[$i]}\" }" >> ${DICTDCONF} > elif [ ${dzfiles[$i]} -a -f ${dzfiles[$i]} ] > then > echo -e "database `basename ${ifiles[$i]} .index` { data \"${dzfiles[$i]}\"\n index \"${ifiles[$i]}\" }" >> ${DICTDCONF} > else > # Never happen. > (( TOTAL -= 1 )) > ewarn "Index ${ifiles[$i]} has no matching dictionary." > fi > fi > done > > # Clean up. > unset datafiles > unset ifiles > unset dfiles > unset dzfiles > > einfo "Loaded ${TOTAL} dictionaries from ${DLIBDIR} ..." >} > >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 $? >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 332481
: 242623