X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Ffunctions;h=7b319444824772b2559914bf17fa402bf6f96238;hb=10ee05c7e767344f9c263616ae45b3ff85317797;hp=b08cc155348f516abb54ad287b41b87eefe6a474;hpb=45b62de23133f687e205da704d031bd322dd6702;p=util-vserver.git diff --git a/scripts/functions b/scripts/functions index b08cc15..7b31944 100644 --- a/scripts/functions +++ b/scripts/functions @@ -282,7 +282,7 @@ function set_init_cwd export INIT_CWD } -function _getVserverDir +function _setVserverDir { local vserver="$1" case "$vserver" in @@ -292,6 +292,15 @@ function _getVserverDir esac } +function _setVserverName +{ + if test -e "$VSERVER_DIR"/name; then + read VSERVER_NAME <"$VSERVER_DIR"/name + else + VSERVER_NAME=$(basename "$VSERVER_DIR") + fi +} + function _pkgMountBindDir() { test "$1" != "$2" || return 0 @@ -510,6 +519,7 @@ function isNamespaceCleanup $_VSERVER_INFO - FEATURE namespace || return 1 cfgdir=$($_VSERVER_INFO "$1" CFGDIR) || return 1 + isAvoidNamespace "$1" && return 1 test -e "$cfgdir"/namespace-cleanup && return 0 test -e "$cfgdir"/nonamespace-cleanup -o \ -e "$__CONFDIR"/.defaults/nonamespace-cleanup && return 1 @@ -591,10 +601,16 @@ function getVserverStatus read _gvs_ctx <"$1"/run eval "$2"=\$_gvs_ctx - test -n "$3" || return 0 - local _gvs_tmp - _getProcNumberCount "$_gvs_ctx" _gvs_tmp - eval "$3"=\$_gvs_tmp + if test "$1" = "$($_VUNAME -g --xid "$_gvs_ctx" context)"; then + test -n "$3" || return 0 + local _gvs_tmp + _getProcNumberCount "$_gvs_ctx" _gvs_tmp + eval "$3"=\$_gvs_tmp + else + test -n "$3" || return 1 + eval "$3"=0 + _gvs_tmp=0 + fi if test "$_gvs_tmp" = 0; then local runfile=$($_READLINK "$1/run") @@ -984,7 +1000,11 @@ function vshelper.doInit local xid xid=$($_VSERVER_INFO "$1" CONTEXT false) && test -n "$xid" || { - warning $"vshelper.init: can not determine xid of vserver '$vserver'; returned value was '$xid'" + warning $"vshelper.init: can not determine xid of vserver '$vserver'; returned value was '$xid' + +This usually means that you're using an init-less init-style, but the +guest isn't configured to start any service. Try enabling a service, +changing the init-style, or making the contexts persistent." return 1 }