Re: [htdig3-dev] new rundig script


Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Fri, 29 Jan 1999 16:41:49 -0600 (CST)


D'oh! I just found a bug in the patch for the new rundig script I posted
yesterday. I forgot to use a "head -1" or "sed 1q" to grab only the first
line from the ls -t. Sorry 'bout that! Here's the corrected patch:

--- rundig.geoff Wed Jan 6 21:17:15 1999
+++ rundig Fri Jan 29 16:37:43 1999
@@ -3,13 +3,23 @@
 #
 # rundig
 #
-# $Id: rundig,v 1.5 1999/01/07 03:17:15 ghutchis Exp $
+# $Id: rundig,v 1.6 1999/01/29 16:37:35 ghutchis Exp $
 #
 # This is a sample script to create a search database for ht://Dig.
 #
-if [ "$1" = "-v" ]; then
- verbose=-v
-fi
+DBDIR=@DATABASE_DIR@
+COMMONDIR=@COMMON_DIR@
+BINDIR=@BIN_DIR@
+
+stats= opts= alt=
+for arg
+do
+ case "$arg" in
+ -a) alt="$arg" ;;
+ -s) stats="$arg" ;;
+ *) opts="$opts $arg" ;; # e.g. -v or -c config
+ esac
+done
 
 #
 # Set the TMPDIR variable if you want htmerge to put files in a location
@@ -18,25 +28,36 @@
 # on some systems, /tmp is a memory mapped filesystem that takes away
 # from virtual memory.
 #
-TMPDIR=@DATABASE_DIR@
+TMPDIR=$DBDIR
 export TMPDIR
 
-@BIN_DIR@/htdig -i $verbose -s
-@BIN_DIR@/htmerge $verbose -s
-@BIN_DIR@/htnotify $verbose
+$BINDIR/htdig -i $opts $stats $alt
+$BINDIR/htmerge $opts $stats $alt
+case "$alt" in
+-a)
+ ( cd $DBDIR && test -f db.docdb.work &&
+ for f in *.work
+ do
+ mv -f $f `basename $f .work`
+ done ) ;;
+esac
+$BINDIR/htnotify $opts
+$BINDIR/htfuzzy $opts soundex metaphone
 
 #
 # Create the endings and synonym databases if they don't exist
-# or if they're older than the files they're generated from!
+# or if they're older than the files they're generated from.
+# These databases are semi-static, so even if pages change,
+# these databases will not need to be rebuilt.
 #
-
-# Do they exist?
-if [ ! -f @COMMON_DIR@/word2root.db ]
+if [ "`ls -t $COMMONDIR/english.0 $COMMONDIR/word2root.db 2>/dev/null | sed 1q`" = \
+ "$COMMONDIR/english.0" ]
 then
- @BIN_DIR@/htfuzzy $verbose endings
+ $BINDIR/htfuzzy $opts endings
 fi
 
-if [ ! -f @COMMON_DIR@/synonyms.db ]
+if [ "`ls -t $COMMONDIR/synonyms $COMMONDIR/synonyms.db 2>/dev/null | sed 1q`" = \
+ "$COMMONDIR/synonyms" ]
 then
- @BIN_DIR@/htfuzzy $verbose synonyms
+ $BINDIR/htfuzzy $opts synonyms
 fi

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
htdig3-dev@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Thu Feb 04 1999 - 22:24:21 PST