X-Git-Url: http://git.onelab.eu/?p=util-vserver.git;a=blobdiff_plain;f=scripts%2Fvuserdel;h=778a0faa876401cf1a962e00d48c04d77054e070;hp=5cc663eedd8c02f74143f6f8db616521242f290e;hb=ec4370f7ebd7fb0ce7f002f5bf2c74f03acd3ec1;hpb=ff1f3af116b63f5bb27bfce9853469fea07e6e66 diff --git a/scripts/vuserdel b/scripts/vuserdel index 5cc663e..778a0fa 100755 --- a/scripts/vuserdel +++ b/scripts/vuserdel @@ -4,10 +4,10 @@ # # Copyright (c) 2004 The Trustees of Princeton University (Trustees). # -# $Id: vuserdel,v 1.6 2004/11/23 14:47:35 mlhuang Exp $ +# $Id: vuserdel,v 1.11 2007/06/29 14:13:01 dhozac Exp $ # -: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} test -e "$UTIL_VSERVER_VARS" || { echo "Can not find util-vserver installation; aborting..." exit 1 @@ -21,17 +21,17 @@ usage() } [ -z "$1" ] && usage +[ "$1" == "--static" ] && { STATIC=yes; shift; } NAME=$1 # read config file to get context ID -. /etc/vservers/$NAME.conf -CTX=$S_CONTEXT +CTX=`cat $__CONFDIR/$NAME/context` # don't bother stopping gracefully, just kill all the processes -$SBINDIR/chcontext --silent --secure --ctx $CTX $PKGLIBDIR/vserverkillall +chcontext --silent --secure --ctx $CTX $__LEGACYDIR/vserverkillall # unmount any directories in vserver that are mount points -for d in `sed -ne "s%^[^ ]* \($VROOTDIR/$NAME/[^ ]*\) .*%\1%p" /proc/mounts` +for d in `sed -ne "s%^[^ ]* \($__DEFAULT_VSERVERDIR/$NAME/[^ ]*\) .*%\1%p" /proc/mounts` do # use echo -e to turn escaped whitespace back into regular chars # be careful about embedded backquotes here (i think we're safe) @@ -40,21 +40,18 @@ do umount -l "$dir" done -# turn resource management off for vserver $NAME -service resman stop $NAME - # delete user -userdel -r $NAME +[ -z "$STATIC" ] && userdel -r $NAME -# remove vserver configuration file -rm -f /etc/vservers/$NAME.conf +# remove vserver configuration directory +rm -rf /etc/vservers/$NAME # remove vserver profile rm -f /var/run/vservers/$NAME.ctx # destroy vserver -if [ -d $VROOTDIR/$NAME ] ; then - TMP=$(mktemp -d "$VROOTDIR/.vtmp/$NAME.XXXXXX") - mv "$VROOTDIR/$NAME" "$TMP" +if [ -d $__DEFAULT_VSERVERDIR/$NAME ] ; then + TMP=$(mktemp -d "$__DEFAULT_VSERVERDIR/.vtmp/$NAME.XXXXXX") + mv "$__DEFAULT_VSERVERDIR/$NAME" "$TMP" rm -rf "$TMP" fi