From fff63d0d7b11df1c17e1285ef82745221e1bd188 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Fri, 8 Dec 2006 13:28:02 +0000 Subject: [PATCH] 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 --- scripts/functions | 20 +++++++++++++++++--- scripts/vserver | 3 +++ scripts/vserver.functions | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) 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%/*}" -- 1.8.1.5