]>
Commit | Line | Data |
---|---|---|
1964ff67 | 1 | #!/bin/sh |
2 | # | |
3 | # $Header$ | |
4 | ||
5 | PATH=/usr/bin:/bin:/usr/sbin:/sbin | |
6 | ||
7 | if [ -d /var/athena ] && [ -w /var/athena ]; then | |
8 | exec >/var/athena/moira_update.log 2>&1 | |
9 | else | |
10 | exec >/tmp/moira_update.log 2>&1 | |
11 | fi | |
12 | ||
13 | # The following exit codes are defined and MUST BE CONSISTENT with the | |
14 | # error codes the library uses: | |
15 | MR_MISSINGFILE=47836473 | |
16 | MR_MKCRED=47836474 | |
17 | MR_TARERR=47836476 | |
18 | ||
19 | TARFILE=/var/tmp/stellar.out | |
20 | SRCDIR=/var/tmp/stellar.dir | |
21 | ||
22 | uchost=`hostname | tr '[a-z]' '[A-Z]'` | |
23 | echo $uchost | egrep -e "\." >/dev/null | |
24 | if [ $? != 0 ]; then | |
25 | uchost=$uchost.MIT.EDU | |
26 | fi | |
27 | ||
28 | # Alert if the tar file does not exist | |
29 | test -r $TARFILE || exit $MR_MISSINGFILE | |
30 | ||
31 | # Make a temporary directory to unpack the tar file into | |
32 | rm -rf $SRCDIR | |
33 | mkdir $SRCDIR || exit $MR_MKCRED | |
34 | cd $SRCDIR || exit $MR_MKCRED | |
35 | ||
36 | # Extract everything | |
37 | tar xpf $TARFILE || exit $MR_TARERR | |
38 | ||
39 | if [ -f "$uchost" ]; then | |
40 | /var/local/stellar-support/moira-to-stellar.perl | |
41 | else | |
42 | exit $MR_MISSINGFILE | |
43 | fi | |
44 | ||
45 | # cleanup | |
46 | cd / | |
47 | rm -rf $SRCDIR | |
48 | test -f $TARFILE && rm -f $TARFILE | |
49 | test -f $0 && rm -f $0 | |
50 | ||
51 | exit 0 |