X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/f4f321854fa126fdea7d16411749e07c283303c1..9925d282e43a0171cc824352717a4c16559651a9:/gen/warehouse.sh diff --git a/gen/warehouse.sh b/gen/warehouse.sh index 34ac4d99..0bb6e416 100644 --- a/gen/warehouse.sh +++ b/gen/warehouse.sh @@ -1,10 +1,5 @@ #!/bin/sh -# -# -DIR=/warehouse/transfers/moirausr -TAR_FILE=$DIR/moira.tar.Z - -PATH="/etc:/bin:/usr/bin:/usr/etc:/usr/athena/etc" +# $Id$ if [ -d /var/athena ] && [ -w /var/athena ]; then exec >/var/athena/moira_update.log 2>&1 @@ -14,26 +9,20 @@ fi # The following exit codes are defined and MUST BE CONSISTENT with the # error codes the library uses: -set MR_MISSINGFILE = 47836473 -set MR_TARERR = 47836476 - -cd $DIR - -echo extracting $TAR_FILE +MR_MISSINGFILE=47836473 -if [ ! -f $TAR_FILE ]; then - exit $MR_MISSINGFILE -fi +PATH="/etc:/bin:/usr/bin:/usr/etc:/usr/athena/etc" +OUTFILE=/warehouse/transfers/moirausr/username_id.map.txt -if zcat < $TAR_FILE | tar xvf -; then - echo Extract successful -else - exit $MR_TARERR -fi +# Alert if the output file doesn't exist +test -r $OUTFILE || exit $MR_MISSINGFILE -chmod 640 username_id.* +# Set the perms usefully +chown root $OUTFILE +chgrp 0 $OUTFILE +chmod 644 $OUTFILE -rm -f $0 -echo removed self +# cleanup +test -f $0 && rm -f $0 exit 0