Don't hardcode the spaces to create/unshare.
[util-vserver.git] / scripts / vserver.functions
index c1751e8..5bfda35 100644 (file)
@@ -278,6 +278,11 @@ function _generateInitOptions
                INITCMD_STOP=(  "$i" "$RUNLEVEL_STOP"  )
            done
            INITCMD_PREPARE=( $_FAKE_RUNLEVEL "$RUNLEVEL_START" /var/run/utmp )
+           OPTS_ENV=( "${OPTS_ENV[@]}" PREVLEVEL=N RUNLEVEL="$RUNLEVEL_START" )
+           if test -n "$OPTION_DEBUG_SYSV"; then
+               INITCMD_START=( /bin/bash -x "${INITCMD_START[@]}" )
+               INITCMD_STOP=( /bin/bash -x "${INITCMD_STOP[@]}" )
+           fi
            ;;
            
        (xplain)
@@ -303,8 +308,8 @@ function _generateInitOptions
        (xgentoo)
            test -n "$RUNLEVEL_START" || RUNLEVEL_START="default"
 
-           INITCMD_START=( /lib/rcscripts/sh/init-vserver.sh "$RUNLEVEL_START" )
-           INITCMD_STOP=( /sbin/rc shutdown )
+           INITCMD_START=( env TERM=$TERM /lib/rcscripts/sh/init-vserver.sh "$RUNLEVEL_START" )
+           INITCMD_STOP=( env -i TERM=$TERM RUNLEVEL=0 /sbin/rc shutdown )
            INITCMD_PREPARE=( $_FAKE_RUNLEVEL 3 /var/run/utmp )
            ;;
 
@@ -690,7 +695,7 @@ function prepareStop
     pushd "$1/vdir" >/dev/null
     case "$INITSTYLE" in
        (sysv)
-           export PREVLEVEL=$RUNLEVEL_START # required by Debian's initscripts
+           export PREVLEVEL=$RUNLEVEL_START RUNLEVEL=$RUNLEVEL_STOP # required by Debian's initscripts
            ;;
     esac
     "${STOPCMD_PREPARE[@]}"