X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fchcontext;h=d30f6453b809a9fa12449639eeefcc2479851070;hb=10ee05c7e767344f9c263616ae45b3ff85317797;hp=fda3e018464a89cc35f45d139a6c7294b0adf888;hpb=a5f72772d44fbf67d1c9c6686299c0874b1c0ee4;p=util-vserver.git diff --git a/scripts/chcontext b/scripts/chcontext index fda3e01..d30f645 100755 --- a/scripts/chcontext +++ b/scripts/chcontext @@ -172,7 +172,12 @@ migrate_cmd=( $_VCONTEXT IFS=$old_IFS -if test -z "$OPT_CTX" || $_VSERVER_INFO -q "$OPT_CTX" XIDTYPE static; then +$_VSERVER_INFO -q "$OPT_CTX" XIDTYPE static +is_static=$? +test -z "$OPT_CTX" +is_dynamic=$? + +if test "$is_dynamic" -eq 0 || test "$is_static" -eq 0; then "${create_cmd[@]}" "${chain_cmd[@]}" -- \ "${migrate_cmd[@]}" --endsetup --migrate-self -- "$@" rc=$? @@ -180,6 +185,13 @@ else rc=254 fi -test "$rc" -ne 254 || exec "$_VTAG" --migrate --tag "$OPT_CTX" --silent -- \ - "${migrate_cmd[@]}" --xid "$OPT_CTX" --migrate -- "$@" +if test "$is_static" -eq 0; then + migrate_cmd=( $_VTAG --migrate --tag "$OPT_CTX" --silent -- \ + $_VSPACE --enter "$OPT_CTX" $OPT_SPACES -- \ + "${migrate_cmd[@]}" ) +fi + + +test "$rc" -ne 254 || exec "${migrate_cmd[@]}" --xid "$OPT_CTX" --migrate -- \ + "$@" exit $rc