]> andersk Git - moira.git/blame - gen/www.sh
Make the DCM error messages not imply they know more than they do
[moira.git] / gen / www.sh
CommitLineData
6b3a8ea3 1#!/bin/sh
2# This script performs updates of the web server.
3# $Header$
4
5PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
6export PATH
7
f4f32185 8if [ -d /var/athena ] && [ -w /var/athena ]; then
9 exec >/var/athena/moira_update.log 2>&1
10else
11 exec >/tmp/moira_update.log 2>&1
12fi
13
6b3a8ea3 14# The following exit codes are defined and MUST BE CONSISTENT with the
15# error codes the library uses:
16MR_HESFILE=47836472
17MR_MISSINGFILE=47836473
18MR_NAMED=47836475
19MR_TARERR=47836476
20
21umask 22
22
23TARFILE=/usr/tmp/www.out
24SRC_DIR=/usr/local/apache/etc
25BIN_DIR=/usr/local/apache/bin
26DEST_DIR=/usr/local/apache/etc
27
28if [ ! -r $TARFILE ]; then
29 exit $MR_MISSINGFILE
30fi
31
32cd $SRC_DIR
33rm -rf build
34mkdir build
35if [ $? != 0 ]; then
36 exit $MR_TARERR
37fi
38
39rm -rf save2
40if [ -d save ]; then
41 mv -f save save2
42fi
43mkdir save
44if [ $? != 0 ]; then
45 exit $MR_TARERR
46fi
47
48cd build
49
50for 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
67done
68
69cd ..
70
71rm -f $TARFILE
72echo removed tarfile
73rm -f $0
74echo removed self
75
76exit 0
This page took 0.056111 seconds and 5 git commands to generate.