]> andersk Git - moira.git/blame - gen/www.sh
Command line printer manipulation client, and build goo.
[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
ce05a39e 20MR_MKCRED=47836474
6b3a8ea3 21
22umask 22
23
24TARFILE=/usr/tmp/www.out
25SRC_DIR=/usr/local/apache/etc
26BIN_DIR=/usr/local/apache/bin
27DEST_DIR=/usr/local/apache/etc
28
29if [ ! -r $TARFILE ]; then
30 exit $MR_MISSINGFILE
31fi
32
33cd $SRC_DIR
34rm -rf build
35mkdir build
36if [ $? != 0 ]; then
37 exit $MR_TARERR
38fi
39
40rm -rf save2
41if [ -d save ]; then
42 mv -f save save2
43fi
44mkdir save
45if [ $? != 0 ]; then
46 exit $MR_TARERR
47fi
48
49cd build
50
51for 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
68done
69
70cd ..
71
72rm -f $TARFILE
73echo removed tarfile
74rm -f $0
75echo removed self
76
77exit 0
This page took 0.207101 seconds and 5 git commands to generate.