# $Id$ --*- sh -*-- # Copyright (C) 2003 Enrico Scholz # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if isVserverRunning "$VSERVER_DIR"; then echo $"vserver '$VSERVER_NAME' already running; aborting..." >&2 exit 1 fi function cleanup() { test -z "$is_started" || return 0 test -z "$is_mounted" || umountVserver "$VSERVER_DIR" &>/dev/null || : test -z "$have_interfaces" || disableInterfaces "$VSERVER_DIR" &>/dev/null || : } is_started= is_mounted= have_interfaces= trap "cleanup" EXIT set -e generateOptions "$VSERVER_DIR" execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" prepre-start enableInterfaces "$VSERVER_DIR" && have_interfaces=1 mountVserver "$VSERVER_DIR" && is_mounted=1 prepareInit "$VSERVER_DIR" cd "$VSERVER_DIR"/vdir/ execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" pre-start cd "$VSERVER_DIR"/vdir/ if $_VSERVER_INFO - FEATURE migrate; then $_CHBIND "${CHBIND_OPTS[@]}" -- \ $_VCONTEXT --create "${OPTS_VCONTEXT_CREATE[@]}" -- \ ${USE_VNAMESPACE:+$_VNAMESPACE --set -- } \ $_VLIMIT --dir "$VSERVER_DIR"/rlimits --missingok -- \ $_VUNAME --dir "$VSERVER_DIR"/uts --missingok -- \ $_VATTRIBUTE --set "${OPTS_VATTRIBUTE[@]}" -- \ $_VCONTEXT --migrate-self --chroot $SILENT_OPT "${OPTS_VCONTEXT_MIGRATE[@]}" -- \ "${INITCMD_START[@]}" else ${NICE_CMD[@]} \ $_CHBIND "${CHBIND_OPTS[@]}" \ $_EXEC_ULIMIT "$VSERVER_DIR/ulimits" \ $_CHCONTEXT_COMPAT "${CHCONTEXT_OPTS[@]}" "${CHCONTEXT_INIT_OPTS[@]}" \ $_SAVE_CTXINFO "$VSERVER_DIR" \ $_CLEARENV \ $_CAPCHROOT "${CAPCHROOT_OPTS[@]}" . \ ${INITCMD_START[@]} fi "${INITCMD_START_SYNC[@]}" execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" post-start is_started=1