]> andersk Git - moira.git/commitdiff
Unpack tarfile in a temporary directory to avoid changing the
authorzacheiss <zacheiss>
Tue, 19 Mar 2002 22:07:06 +0000 (22:07 +0000)
committerzacheiss <zacheiss>
Tue, 19 Mar 2002 22:07:06 +0000 (22:07 +0000)
permissions of the directory we unpack into.

gen/ip-billing.sh

index afba3bb4c1299ee0360e0ee09a177fba59f0014e..ae6acd5f3d0be74871da3db316302a2113fb6b7c 100755 (executable)
@@ -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
This page took 0.039553 seconds and 5 git commands to generate.