From e0687f8f5c5d7efeb989f15385a8f2d766e2f24c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 27 Jan 2002 22:33:48 +0000 Subject: Misc. bugfixes and tweaks to localrundig: - Be less strict on filename characters. - Remove debug mess. - Use LOCALDBDIR consistently (prepare for passing on to upstream by simply s/(LOCAL|local)//. - Separate static and semi-static (generate-once) language files from db files. --- localrundig | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'localrundig') diff --git a/localrundig b/localrundig index ee81ed5..f8cb8d3 100755 --- a/localrundig +++ b/localrundig @@ -3,7 +3,7 @@ # # rundig # -# $Id: localrundig,v 1.2 2002-01-21 04:06:50 jonas Exp $ +# $Id: localrundig,v 1.3 2002-01-27 22:33:48 jonas Exp $ # # This is a sample script to create a search database for ht://Dig. # @@ -11,8 +11,6 @@ DBDIR=/var/lib/htdig COMMONDIR=/etc/htdig BINDIR=/usr/bin -LOCALLIBDIR=/usr/local/lib/htdig -LOCALDBDIR=/var/local/lib/htdig # To help debug problems, try running rundig -vvv # This will add lots of debugging output to all of the programs stats= opts= alt= init= @@ -26,14 +24,17 @@ do esac done -config=`echo "$opts"|sed 's/.*-c[[:space:]]\+\([[:alnum:]/.]\+\).*/\1/'` +config=`echo "$opts"|sed 's/^.*-c[[:space:]]\+\([[:alnum:]/._-]\+\).*$/\1/'` test -n "$config" || config=/etc/htdig/htdig.conf -locale=`grep '^locale:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_]\+\).*/\1/'` +locale=`grep '^locale:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_-]\+\).*/\1/'` test -n "$locale" || locale=en_US -search_object=`grep '^search_object:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_]\+\).*/\1/'` -echo grep '^search_object:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_]\+\).*/\1/' -echo "S: $search_object C: $config" -test -d $LOCALDBDIR/db/$search_object || mkdir $LOCALDBDIR/db/$search_object +search_object=`grep '^search_object:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_-]\+\).*/\1/'` + +LOCALDBDIR=/var/local/lib/htdig/db/$search_object +LOCALLANGSTATICDIR=/usr/local/lib/htdig/lang/$locale +LOCALLANGDIR=/var/local/lib/htdig/lang/$locale + +test -d $LOCALDBDIR || mkdir $LOCALDBDIR # # Set the TMPDIR variable if you want htmerge to put files in a location @@ -42,14 +43,14 @@ test -d $LOCALDBDIR/db/$search_object || mkdir $LOCALDBDIR/db/$search_object # on some systems, /tmp is a memory mapped filesystem that takes away # from virtual memory. # -TMPDIR=${TMPDIR:-$DBDIR} +TMPDIR=${TMPDIR:-$LOCALDBDIR} export TMPDIR $BINDIR/htdig $init $opts $stats $alt LC_COLLATE=C $BINDIR/htmerge $opts $stats $alt case "$alt" in -a) - ( cd $DBDIR && test -f db.docdb.work && + ( cd $LOCALDBDIR && test -f db.docdb.work && for f in *.work do mv -f $f `basename $f .work` @@ -77,14 +78,14 @@ en_*) $BINDIR/htfuzzy $opts soundex ;; esac -if [ "`ls -t $LOCALLIBDIR/lang/$locale/dict.0 $LOCALDBDIR/lang/$locale/word2root.db 2>/dev/null | sed 1q`" = \ - "$LOCALLIBDIR/lang/$locale/dict.0" ] +if [ "`ls -t $LOCALLANGSTATICDIR/dict.0 $LOCALLANGDIR/word2root.db 2>/dev/null | sed 1q`" = \ + "$LOCALLANGSTATICDIR/dict.0" ] then $BINDIR/htfuzzy $opts endings fi -if [ "`ls -t $LOCALLIBDIR/lang/$locale/synonyms $LOCALDBDIR/lang/$locale/synonyms.db 2>/dev/null | sed 1q`" = \ - "$LOCALLIBDIR/lang/$locale/synonyms" ] +if [ "`ls -t $LOCALLANGSTATICDIR/synonyms $LOCALLANGDIR/synonyms.db 2>/dev/null | sed 1q`" = \ + "$LOCALLANGSTATICDIR/synonyms" ] then $BINDIR/htfuzzy $opts synonyms fi -- cgit v1.2.3