X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fchcontext;h=2fb254c95033e78676cde02b406e3bcbbf08cbd7;hb=95e2774070e989fe9cf9f48dae5fa054e55e2a3e;hp=bfe2d5120612e242c73a988388da07b77431a2ab;hpb=2822ba293eb308225c50d346930c47bf98d9927b;p=util-vserver.git diff --git a/scripts/chcontext b/scripts/chcontext index bfe2d51..2fb254c 100755 --- a/scripts/chcontext +++ b/scripts/chcontext @@ -1,5 +1,5 @@ #! /bin/bash -# $Id: chcontext,v 1.19 2005/04/08 19:14:47 ensc Exp $ +# $Id: chcontext 2599 2007-08-26 21:30:50Z dhozac $ # Copyright (C) 2004 Enrico Scholz # @@ -27,7 +27,7 @@ test -e "$UTIL_VSERVER_VARS" || { function showHelp() { echo \ -$"Usage: /usr/sbin/chcontext [--cap [!]] [--secure] [--xid ] [--disconnect] +$"Usage: $1 [--cap [!]] [--secure] [--xid ] [--disconnect] [--domainname ] [--hostname ] [--flag +] [--silent] [--] command arguments ... @@ -84,7 +84,7 @@ By default, a new/unused context is allocated Do not print the allocated context number. Report bugs to <$PACKAGE_BUGREPORT>." - exit $1 + exit $2 } function showVersion() @@ -114,8 +114,8 @@ OPT_INITPID= while true; do case "$1" in - --help) showHelp $0 ;; - --version) showVersion ;; + --help) showHelp $0 0;; + --version) showVersion 0;; --cap) OPT_CAPS=( "${OPT_CAPS[@]}" "$2" ); shift;; --ctx|--xid) OPT_CTX=$2; shift;; --disconnect) OPT_DISCONNECT=1;; @@ -134,7 +134,8 @@ while true; do shift done -create_cmd=( $_VCONTEXT --create --silentexist +create_cmd=( ${OPT_CTX:+$_VTAG --create --tag "$OPT_CTX" --silentexist --silent --} + $_VCONTEXT --create --silentexist ${OPT_SILENT:+--silent} ${OPT_CTX:+--xid "$OPT_CTX"} ) @@ -153,9 +154,9 @@ test -z "$OPT_DOMAINNAME$OPT_HOSTNAME" || \ chain_cmd=( "${chain_cmd[@]}" -- $_VATTRIBUTE --set + ${OPT_SECURE:+--secure} ${OPT_CAPS:+--bcap "${OPT_CAPS[*]}"} - ${OPT_FLAGS:+--flag "${OPT_FLAGS[*]}"} - ${OPT_SECURE:+--secure} ) + ${OPT_FLAGS:+--flag "${OPT_FLAGS[*]}"} ) migrate_cmd=( $_VCONTEXT ${OPT_SILENT:+--silent} @@ -172,5 +173,6 @@ else rc=254 fi -test "$rc" -ne 254 || exec "${migrate_cmd[@]}" --xid "$OPT_CTX" --migrate -- "$@" +test "$rc" -ne 254 || exec "$_VTAG" --migrate --tag "$OPT_CTX" --silent -- \ + "${migrate_cmd[@]}" --xid "$OPT_CTX" --migrate -- "$@" exit $rc