-# cd $TMPDIR; tar xf $TARFILE
-for QFILE in $TMPDIR/\\*; do
- while :; do
- read login dir uid gid quota
- if [ $? != 0 ]; then exit 0; fi
- path=$dir/$login
- echo mkdir $path
- echo chown $uid $path
- echo chgrp $gid $path
- echo setquota `expr $QFILE : '[^\]*\(.*\)' \
-| sed 's,\\\\,/,g'` $uid $quota
- done <$QFILE
+
+# Alert if the tar file does not exist
+test -r $TARFILE || exit $MR_MISSINGFILE
+
+# Make a temporary directory to unpack the tar file into
+rm -rf $SRCDIR
+mkdir $SRCDIR || exit $MR_MKCRED
+cd $SRCDIR || exit $MR_MKCRED
+
+# Extract everything
+tar xpf $TARFILE || exit $MR_TARERR
+
+for type in dirs quotas; do
+ echo "Installing ${type}:"
+ for i in $uchost.$type; do
+ if [ -f $i ]; then
+ # Convert from the filename HOST.@dev@device.type to /dev/device
+ dev=`echo $i | sed "s,.${type},," | sed "s,${uchost}.,," | \
+ sed "s,@,/,g"`
+ echo ${uchost}:$dev
+ ./install_${type} $dev < $i
+ if [ $? != 0 ]; then
+ exit $MR_NOCRED
+ fi
+ if [ ${type} = "quotas" ]; then
+ ./zero_quotas $dev < $i
+ if [ $? != 0 ]; then
+ exit $MR_NOCRED
+ fi
+ fi
+ mv -f $i /var/tmp
+ fi
+ done