#
# Copyright (c) 2004 The Trustees of Princeton University (Trustees).
#
-# $Id: vuseradd,v 1.15 2004/11/06 16:10:42 mlhuang Exp $
+# $Id: vuseradd,v 1.16 2004/11/12 18:44:09 mef Exp $
#
: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
"$PKGLIBDIR/vbuild" "$VROOTDIR/vserver-reference" "$TMP"
RETVAL=$?
# move it to .vcache when complete
- if [ $RETVAL -ne 0 ] || \
- [ $(du -b -s "$TMP" | awk "{ print \$1 }") -lt \
- $(du -b -s "$VROOTDIR/vserver-reference" | awk "{ print \$1 }") ] ; then
+ if [ $RETVAL -ne 0 ] ; then
echo "Error $RETVAL building $VROOTDIR/$NAME"
chattr -R -i "$TMP"
rm -rf "$TMP"
+ userdel $NAME
exit $RETVAL
else
+ # sanity check
+ vnewsize=$(du -s "$TMP" | awk "{ print \$1 }")
+ vrefsize=$(du -s "$VROOTDIR/vserver-reference" | awk "{ print \$1 }")
+ if [ $vnewsize -lt $vrefsize ] ; then
+ echo "Error 'du -s $VROOTDIR/$NAME'=$vnewsize < 'du -s $VROOTDIR/vserver-reference'=$vrefsize"
+ chattr -R -i "$TMP"
+ rm -rf "$TMP"
+ userdel $NAME
+ exit 256
+ fi
+
mv "$TMP" "$VROOTDIR/$NAME"
fi
fi