X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Ffunctions;h=f0ddff2a921364a80484cdbad4df1ec5ab882684;hb=636875649376f36e02848dde1c1017a119b4fff4;hp=8f73ec8eac3f2ed83dfb201fde604eb02d9113a7;hpb=da54055d8657f709741f35ff0522bfeb7903538f;p=util-vserver.git diff --git a/scripts/functions b/scripts/functions index 8f73ec8..f0ddff2 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 } @@ -622,13 +636,17 @@ function getFileValue eval read "$_gfv_var" <"$_gfv_file" } -## Called as 'getFileArray ' +## Called as 'getFileArray +' function getFileArray { - test -r "$2" || return 1 - + local _gfa_var=$1 + local _gfa_file + shift + + findFile _gfa_file "$@" '' + test -n "$_gfa_file" -a -r "$_gfa_file" || return 0 local IFS=$_VS_NEWLINE - eval "$1"='( $(< "$2") )' + eval "$_gfa_var"='( $(< "$_gfa_file") )' } function checkComponents @@ -826,9 +844,11 @@ function vshelper.doSanityCheck vshelper=$(cat "$proc_file") $_CMP -s "$vshelper" "$_VSHELPER" || { + local readable="" + test -r "$vshelper" && readable=1 warnings=( "${warnings[@]}" $"The configured vshelper '$vshelper' does not match the 'vshelper' - script of the util-vserver package" + script of the util-vserver package.${readable:+ Maybe you have two versions installed?}" ) solution_disable=1 solution_sysctl=1