Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/woip/sh/process-updates
blob: 060128badcb02305b52b3dacc6679d47306e00dd (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
#!/bin/sh

set -e 
set -o pipefail

if [ ! -n "$1" ]; then
  echo "process <file.processed>"
  exit 1
else
  file=`readlink -f $1`
fi

# drop the trailing '.processed'
basename=${file%.processed}

ifile="$basename.index.txt"
if [ ! -e $ifile ]; then
    echo "Creating index..."
    pushd woip/rb
    ruby ./index.rb $file > $ifile.tmp
    mv $ifile.tmp $ifile
    popd
fi

sfile="$basename.locate.db"
if [ ! -e $sfile ]; then
    echo "Creating locate index..."
    PATH=$PATH:./locate.freebsd/bigram/:./locate.freebsd/code 
    cat $ifile | LC_ALL=C ./locate.freebsd/locate/mklocatedb.sh > $sfile.tmp
    mv $sfile.tmp $sfile
fi

spfile="$basename.locate.prefixdb"
if [ ! -e $spfile ]; then
    echo "Creating locate prefix index..."
    woip/c/lsearcher -f $sfile -c $spfile.tmp -n
    mv $spfile.tmp $spfile
fi

bfile="$basename.blocks.db"
if [ ! -e $bfile ]; then
    echo "Creating block index"
    woip/c/bzipreader -f $file -l | awk '{print $2;}' | woip/c/blocks $bfile.tmp
    mv $bfile.tmp $bfile
fi