findObject -d "$@"
}
+function findAndCopy
+{
+ local dst=$1
+ test ! -s "$dst" || return 0
+
+ local tmp
+ shift
+ findFile tmp "$@"
+
+ test "$tmp" -a -s "$tmp" || return 0
+ cp -af "$tmp" "$dst"
+}
+
function getPhysicalDir
{
( set -P && cd "$1" && pwd )
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>]]
local IFS=$_VS_NEWLINE
eval "$1"='( $(< "$2") )'
}
+
+function checkComponents
+{
+ local i
+ local msg=$1
+ local x_failed=
+
+ shift
+
+ for i; do
+ local failed=
+ case "$i" in
+ core) test -x "$_CHBIND" || failed=1;;
+ build) test -x "$_VSERVER_BUILD" || failed=1;;
+ sysv) test -x "$INITRDDIR/vserver" || failed=1;;
+ devel) test -d "$INCLUDEDIR/vserver.h" || failed=1;;
+ *) echo "Unknown component '$i'"
+ return false
+ ;;
+ esac
+
+ test -z "$failed" || {
+ echo "$msg: $i"
+ x_failed=1
+ }
+ done
+
+ test -z "$x_failed"
+}