]>
Commit | Line | Data |
---|---|---|
6b3a8ea3 | 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 | ||
f4f32185 | 8 | if [ -d /var/athena ] && [ -w /var/athena ]; then |
9 | exec >/var/athena/moira_update.log 2>&1 | |
10 | else | |
11 | exec >/tmp/moira_update.log 2>&1 | |
12 | fi | |
13 | ||
6b3a8ea3 | 14 | # The following exit codes are defined and MUST BE CONSISTENT with the |
15 | # error codes the library uses: | |
16 | MR_HESFILE=47836472 | |
17 | MR_MISSINGFILE=47836473 | |
18 | MR_NAMED=47836475 | |
19 | MR_TARERR=47836476 | |
20 | ||
21 | umask 22 | |
22 | ||
23 | TARFILE=/usr/tmp/www.out | |
24 | SRC_DIR=/usr/local/apache/etc | |
25 | BIN_DIR=/usr/local/apache/bin | |
26 | DEST_DIR=/usr/local/apache/etc | |
27 | ||
28 | if [ ! -r $TARFILE ]; then | |
29 | exit $MR_MISSINGFILE | |
30 | fi | |
31 | ||
32 | cd $SRC_DIR | |
33 | rm -rf build | |
34 | mkdir build | |
35 | if [ $? != 0 ]; then | |
36 | exit $MR_TARERR | |
37 | fi | |
38 | ||
39 | rm -rf save2 | |
40 | if [ -d save ]; then | |
41 | mv -f save save2 | |
42 | fi | |
43 | mkdir save | |
44 | if [ $? != 0 ]; then | |
45 | exit $MR_TARERR | |
46 | fi | |
47 | ||
48 | cd build | |
49 | ||
50 | for file in `tar tf $TARFILE | awk '{print $1}' | sed 's;/$;;'` ; do | |
51 | if [ $file != . ]; then | |
52 | rm -rf $file | |
53 | echo extracting $file | |
54 | tar xf $TARFILE $file | |
55 | if [ $? != 0 ]; then | |
56 | exit $MR_TARERR | |
57 | fi | |
58 | $BIN_DIR/dbmanage $file import $file.db | |
59 | if [ $? != 0 ]; then | |
60 | exit $MR_TARERR | |
61 | fi | |
62 | mv $DEST_DIR/$file $SRC_DIR/save/$file | |
63 | mv $DEST_DIR/$file.db $SRC_DIR/save/$file.db | |
64 | mv $SRC_DIR/build/$file $DEST_DIR/$file | |
65 | mv $SRC_DIR/build/$file.db $DEST_DIR/$file.db | |
66 | fi | |
67 | done | |
68 | ||
69 | cd .. | |
70 | ||
71 | rm -f $TARFILE | |
72 | echo removed tarfile | |
73 | rm -f $0 | |
74 | echo removed self | |
75 | ||
76 | exit 0 |