X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/2c0dfed5194f8639c512faa887442eb98cf70f11..0041862dcee4646f8bc7fea981e1fb7007cc066f:/gen/ip-billing.sh diff --git a/gen/ip-billing.sh b/gen/ip-billing.sh index afba3bb4..ae6acd5f 100755 --- a/gen/ip-billing.sh +++ b/gen/ip-billing.sh @@ -1,7 +1,6 @@ #!/bin/sh # -# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/stel -lar.sh,v 1.1 2002/01/18 06:54:45 zacheiss Exp $ +# $Header$ PATH=/usr/bin:/bin:/usr/sbin:/sbin @@ -15,17 +14,32 @@ fi # error codes the library uses: MR_MISSINGFILE=47836473 MR_TARERR=47836476 +MR_MKCRED=47836474 OUTFILE=/var/tmp/ip-billing.out +OUTDIR=/var/tmp/ip-billing.dir # Alert if the output file doesn't exist test -r $OUTFILE || exit $MR_MISSINGFILE +# Make a temporary directory to unpack files into. +rm -rf $OUTDIR +mkdir $OUTDIR || exit $MR_MKCRED +cd $OUTDIR || exit $MR_MKCRED + # unpack the file -(cd /var/tmp && tar xf $OUTFILE) || exit $MR_TARERR +tar xpf $OUTFILE || exit $MR_TARERR +for i in ctl dat; do + if [ ! -f moira.$i ]; then + exit $MR_MISSINGFILE + fi + mv moira.$i /var/tmp +done # cleanup -rm -f $OUTFILE +cd / +rm -rf $OUTDIR +test -f $OUTFILE && rm -f $OUTFILE test -f $0 && rm -f $0 exit 0