findDir APTCACHEDIR "$VDIR"/var/cache/apt
findDir APTARCHIVDIR "$VDIR"/var/cache/apt/archives /var/cache/apt/archives
fi
+
+ findFile APT_CONFIG "$APTETCDIR"/apt.conf ""
+ test -z "$APT_CONFIG" || export APT_CONFIG
}
function _pkgMountBase
function getAllVservers
{
local i
- declare -a tmp=()
+ declare -a _tmp=()
for i in $CONFDIR/*; do
test -d "$i" || continue
test ! -e "$i"/disabled || continue
test -d "$i"/vdir || continue
+ case "$i" in
+ *.~*~) continue;;
+ esac
- tmp=( "${tmp[@]}" "${i##$CONFDIR/}")
+ _tmp=( "${_tmp[@]}" "${i##$CONFDIR/}")
done
- eval $1=\$tmp
+ eval $1='( "${_tmp[@]}" )'
}
## Usage: getVserverCtx <vdir> <result-varname> [<procnumber-varname> [<do-cleanup>]]
function getVserverStatus
{
test -r "$1"/run || return 1
- eval read "$2" <"$1"/run
+
+ local _ctx
+ read _ctx <"$1"/run
+ eval "$2"=\$_ctx
test "$3" || return 0
- local _tmp=$($_VPS ax | $_AWK '{print $2}' | $_GREP -x "$ctx" | $_WC -l )
+ local _tmp=$($_VPS ax | $_AWK '{print $2}' | $_GREP -x "$_ctx" | $_WC -l )
eval "$3"=\$_tmp
test "$4" -a $_tmp = 0 || return 0
return 0
}
+## Usage: isCtxRunning <ctx>
+function isCtxRunning
+{
+ local _tmp=$($_VPS ax | $_AWK '{print $2}' | $_GREP -x "$1" | $_WC -l )
+ test $_tmp -gt 0
+}
+
## Usage: isVserverRunning <vdir> [<ctx-varname>]
function isVserverRunning
{