ora_sync.sh

 

#
### oraclesync.sh
###
### Generate hyperlinked reference to
### Oracle tables specs in a Peforce Repository
###
###
### This script should be run on the Huxley box
###




###
### Lights for navigating the labyrinth.
###
date
olddir=`pwd`


###
### In this version, oracle depot code needs to sit under a document root.
###
###
ora=/usr/tomcat/webapps/ROOT/depot/oracle




###
### Sync with Perforce depot to get newest code
###

rm -rf  $ora/*
P4CLIENT=www.setgetweb.com.ora
export P4CLIENT
p4 sync  > /tmp/oralist.tmp

grep -E 'updating|added|refreshing' /tmp/oralist.tmp | \
grep cbo-afton | \
cut -d"#" -f1 | \
sed "s://depot/dev/cbo-afton/primary/install/oracle/:/usr/tomcat/webapps/ROOT/depot/oracle/:" | \
sed "s/$/.html/" > /tmp/oralist.out 



###
### Recurse through subdirectories and
### Create HTML versions of all text files
###

echo " "
echo "Creating HTML files"
for i in `cat /tmp/oralist.out`
do
   z=`dirname $i`
   f=`basename $i .html`
   echo $z $f
   cd $z
   convertb.sh $f
done



### 
### Derive index.html file
### 

/usr/local/bin/oracleidx.sh


###
### Recurse through subdirectories
### For every *.html file found, 
### send request to generate links
###

echo " "
echo "Generating links..."
for i in `ls -lR $ora | grep -v " " | grep \/ | sed "s/://g"`
do
   cd $i
   for z in `ls *.html 2>/dev/null | \
             grep -v \.html.html | \
             grep -v index.html` 
   do
       x=`basename $z .html`
       oraclelink.sh $z $x
   done

done

###
### Generate links to actual data in tables
### Need to have Oracle-Apache server running
### and need to have run show_table stored
### procedure against the database.
###
### See Jack Tsai for more info.
###

echo " "
echo "Generating links..."
for i in `ls -lR $ora | grep -v " " | grep \/ | sed "s/://g"`
do
   cd $i
   for z in `ls *.html 2>/dev/null | \
             grep -v \.html.html | \
             grep -v index.html` 
   do
       x=`basename $z .html`
       show_tablelink.sh $z $x
   done

done



###
### Generate hyperlinks 
###
cd /usr/tomcat/webapps/ROOT/depot/oracle
sh ./linklist.sh


###
### Go home.  
### Check to see how long we were gone.
###
cd $olddir
date