]> andersk Git - moira.git/blob - gen/www.sh
www and postoffice dcms, from tom
[moira.git] / gen / www.sh
1 #!/bin/sh
2 # This script performs updates of the web server.
3 # $Header$
4
5 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
6 export PATH
7
8 # The following exit codes are defined and MUST BE CONSISTENT with the
9 # error codes the library uses:
10 MR_HESFILE=47836472
11 MR_MISSINGFILE=47836473
12 MR_NAMED=47836475
13 MR_TARERR=47836476
14
15 umask 22
16
17 TARFILE=/usr/tmp/www.out
18 SRC_DIR=/usr/local/apache/etc
19 BIN_DIR=/usr/local/apache/bin
20 DEST_DIR=/usr/local/apache/etc
21
22 if [ ! -r $TARFILE ]; then
23         exit $MR_MISSINGFILE
24 fi
25
26 cd $SRC_DIR
27 rm -rf build
28 mkdir build
29 if [ $? != 0 ]; then
30         exit $MR_TARERR
31 fi
32
33 rm -rf save2
34 if [ -d save ]; then
35         mv -f save save2
36 fi
37 mkdir save
38 if [ $? != 0 ]; then
39         exit $MR_TARERR
40 fi
41
42 cd build
43
44 for file in `tar tf $TARFILE | awk '{print $1}' | sed 's;/$;;'` ; do
45         if [ $file != . ]; then
46                 rm -rf $file
47                 echo extracting $file
48                 tar xf $TARFILE $file
49                 if [ $? != 0 ]; then
50                          exit $MR_TARERR
51                 fi
52                 $BIN_DIR/dbmanage $file import $file.db 
53                 if [ $? != 0 ]; then
54                         exit $MR_TARERR
55                 fi
56                 mv $DEST_DIR/$file $SRC_DIR/save/$file
57                 mv $DEST_DIR/$file.db $SRC_DIR/save/$file.db
58                 mv $SRC_DIR/build/$file $DEST_DIR/$file
59                 mv $SRC_DIR/build/$file.db $DEST_DIR/$file.db
60         fi
61 done
62
63 cd ..
64
65 rm -f $TARFILE
66 echo removed tarfile
67 rm -f $0
68 echo removed self
69
70 exit 0
This page took 0.040441 seconds and 5 git commands to generate.