]>
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 | |
ce05a39e | 20 | MR_MKCRED=47836474 |
6b3a8ea3 | 21 | |
22 | umask 22 | |
23 | ||
24 | TARFILE=/usr/tmp/www.out | |
25 | SRC_DIR=/usr/local/apache/etc | |
26 | BIN_DIR=/usr/local/apache/bin | |
27 | DEST_DIR=/usr/local/apache/etc | |
28 | ||
29 | if [ ! -r $TARFILE ]; then | |
30 | exit $MR_MISSINGFILE | |
31 | fi | |
32 | ||
33 | cd $SRC_DIR | |
34 | rm -rf build | |
35 | mkdir build | |
36 | if [ $? != 0 ]; then | |
37 | exit $MR_TARERR | |
38 | fi | |
39 | ||
40 | rm -rf save2 | |
41 | if [ -d save ]; then | |
42 | mv -f save save2 | |
43 | fi | |
44 | mkdir save | |
45 | if [ $? != 0 ]; then | |
46 | exit $MR_TARERR | |
47 | fi | |
48 | ||
49 | cd build | |
50 | ||
51 | for file in `tar tf $TARFILE | awk '{print $1}' | sed 's;/$;;'` ; do | |
52 | if [ $file != . ]; then | |
53 | rm -rf $file | |
54 | echo extracting $file | |
55 | tar xf $TARFILE $file | |
56 | if [ $? != 0 ]; then | |
57 | exit $MR_TARERR | |
58 | fi | |
59 | $BIN_DIR/dbmanage $file import $file.db | |
60 | if [ $? != 0 ]; then | |
ce05a39e | 61 | exit $MR_MKCRED |
6b3a8ea3 | 62 | fi |
63 | mv $DEST_DIR/$file $SRC_DIR/save/$file | |
64 | mv $DEST_DIR/$file.db $SRC_DIR/save/$file.db | |
65 | mv $SRC_DIR/build/$file $DEST_DIR/$file | |
66 | mv $SRC_DIR/build/$file.db $DEST_DIR/$file.db | |
67 | fi | |
68 | done | |
69 | ||
70 | cd .. | |
71 | ||
72 | rm -f $TARFILE | |
73 | echo removed tarfile | |
74 | rm -f $0 | |
75 | echo removed self | |
76 | ||
77 | exit 0 |