X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvserver.start;h=99a123eb6c86853bd8b4fe92b1205b334f542a58;hb=bb95a260f18983e80abcad495bd224b386a705e1;hp=f049d8384ab5e6220d51c4c411a239f54f6f89ab;hpb=3d77ffaa696534e6b97e9440154091649608399e;p=util-vserver.git diff --git a/util-vserver/scripts/vserver.start b/util-vserver/scripts/vserver.start index f049d83..99a123e 100644 --- a/util-vserver/scripts/vserver.start +++ b/util-vserver/scripts/vserver.start @@ -15,21 +15,22 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -lock "$LOCKDIR"/vserver."$(echo "$VSERVER_DIR" | tr -dc a-zA-Z0-9)".startup + +lock "$LOCKDIR"/vserver."$($_VSERVER_INFO "$VSERVER_DIR" CANONIFY)".startup if isVserverRunning "$VSERVER_DIR"; then - echo $"vserver '$VSERVER_NAME' already running; aborting..." >&2 - exit 1 + warning $"vserver '$VSERVER_NAME' already running" + exit 0 fi function cleanup() { set +e - test -z "$startsync_pipe" || rm -f "$startsync_pipe" + test -z "$startsync_pipe" || $_RM -f "$startsync_pipe" test -z "$is_started" || { unlock; return 0; } - if test "$is_configured" -a -z "$is_executed"; then + if test -n "$is_configured" -a -z "$is_executed"; then warning $" An error occured while executing the vserver startup sequence; when there are no other messages, it is very likely that the init-script @@ -41,7 +42,7 @@ Common causes are: appending 'true' to this file will help." fi - if test "$is_executed"; then + if test -n "$is_executed"; then warning $" An error occured after executing the vserver startup sequence. This means that some processes may exist in the created context and the @@ -56,7 +57,7 @@ is recommended to fix this." Failed to start vserver '$VSERVER_NAME'" fi - test "$OPTION_DEBUG" || exec 2>/dev/null >/dev/null + test -n "$OPTION_DEBUG" || exec 2>/dev/null >/dev/null test -z "$is_mounted" || umountVserver "$VSERVER_DIR" || : test -z "$have_interfaces" || disableInterfaces "$VSERVER_DIR" || : @@ -74,8 +75,9 @@ startsync_pipe= set -e trap "cleanup" EXIT -vshelper.doSanityCheck +sanityCheck "$VSERVER_DIR" +mountRootFS "$VSERVER_DIR" generateOptions "$VSERVER_DIR" execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" prepre-start enableInterfaces "$VSERVER_DIR" && have_interfaces=1 @@ -92,6 +94,7 @@ test -z "$OPTION_DEFAULTTTY" || setDefaultTTY "$VSERVER_DIR" pushd "$VSERVER_DIR"/vdir/ >/dev/null is_configured=1 if $_VSERVER_INFO - FEATURE migrate; then + ${NICE_CMD[@]} \ $_CHBIND "${CHBIND_OPTS[@]}" -- \ $_VCONTEXT --create "${OPTS_VCONTEXT_CREATE[@]}" -- \ ${USE_VNAMESPACE:+$_VNAMESPACE --set -- } \ @@ -102,14 +105,14 @@ if $_VSERVER_INFO - FEATURE migrate; then $_VUNAME --xid self --set -t context="$VSERVER_DIR" -- \ $_VATTRIBUTE --set "${OPTS_VATTRIBUTE[@]}" -- \ $_SAVE_CTXINFO "$VSERVER_DIR" \ - $_CLEARENV \ + $_ENV -i -- \ $_VCONTEXT --migrate-self --endsetup --chroot $SILENT_OPT "${OPTS_VCONTEXT_MIGRATE[@]}" -- \ "${INITCMD_START[@]}" else - if test "$_IS_FAKEINIT"; then - startsync_pipe=$(mktemp /tmp/vserver-start.XXXXXX) - rm -f "$startsync_pipe" - mkfifo -m600 "$startsync_pipe" ## safe, since mkfifo does not follow symlinks + if test -n "$_IS_FAKEINIT"; then + startsync_pipe=$($_MKTEMP /tmp/vserver-start.XXXXXX) + $_RM -f "$startsync_pipe" + $_MKFIFO -m600 "$startsync_pipe" ## safe, since mkfifo does not follow symlinks fi ${NICE_CMD[@]} \ @@ -117,7 +120,7 @@ else $_EXEC_ULIMIT "$VSERVER_DIR/ulimits" \ $_CHCONTEXT_COMPAT "${CHCONTEXT_OPTS[@]}" "${CHCONTEXT_INIT_OPTS[@]}" \ $_SAVE_CTXINFO "$VSERVER_DIR" \ - $_CLEARENV \ + $_ENV -i -- \ $_CHAINECHO "${_IS_FAKEINIT:+$startsync_pipe}" "" \ $_CAPCHROOT "${CAPCHROOT_OPTS[@]}" . \ "${INITCMD_START[@]}"