From: Daniel Hokka Zakrisson Date: Fri, 8 Dec 2006 13:28:02 +0000 (+0000) Subject: Rather than keeping an unnecessary mount around just because it was the cwd, cd to... X-Git-Tag: release-0.30.212~5 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fff63d0d7b11df1c17e1285ef82745221e1bd188;p=util-vserver.git Rather than keeping an unnecessary mount around just because it was the cwd, cd to the root at the beginning while storing the original cwd (so it can be used later). git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2418 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/scripts/functions b/scripts/functions index 8f73ec8..61dbd00 100644 --- a/scripts/functions +++ b/scripts/functions @@ -268,13 +268,27 @@ function unlock _VS_LOCKS="$@" } +function get_init_cwd +{ + if test -n "$INIT_CWD"; then + echo "$INIT_CWD" + else + pwd + fi +} +function set_init_cwd +{ + INIT_CWD="`pwd`" + export INIT_CWD +} + function _getVserverDir { local vserver="$1" case "$vserver" in - ./*) VSERVER_DIR=`pwd`/$vserver ;; - /*) VSERVER_DIR=$vserver ;; - *) VSERVER_DIR=$__CONFDIR/$vserver;; + ./*) VSERVER_DIR="`get_init_cwd`/$vserver";; + /*) VSERVER_DIR="$vserver" ;; + *) VSERVER_DIR="$__CONFDIR/$vserver" ;; esac } diff --git a/scripts/vserver b/scripts/vserver index db03034..f4080a6 100755 --- a/scripts/vserver +++ b/scripts/vserver @@ -206,6 +206,9 @@ test "$2" != enter -a "$2" != stop || \ ! isVserverRunning "$VSERVER_DIR" || \ exec $_VNAMESPACE --enter "$VSERVER_DIR" -- $_VSERVER ----nonamespace "${OPTIONS_ORIG[@]}" +set_init_cwd +cd / + . $__PKGLIBDIR/vserver.functions case "$2" in (start|stop|delete) diff --git a/scripts/vserver.functions b/scripts/vserver.functions index 260bd6e..6d25458 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -1199,7 +1199,7 @@ function _namespaceCleanup # these are things that have to be accessible post-cleanup for tmp in "$root" "$__SBINDIR" "$__PKGLIBDIR" "$vdir" \ - "$__PKGSTATEDIR" "`pwd`" "${skip[@]}"; do + "$__PKGSTATEDIR" "${skip[@]}"; do while test -n "$tmp"; do list=( "${list[@]}" "$tmp" ) tmp="${tmp%/*}"