X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=85d5a5258b9b96bebebbc66fe205a64064af53fc;hb=97a127fd10421a30f02d64fca74f4df6acf4a0bd;hp=ba07f332c1978467deb81ee39a927245b5b05973;hpb=ca2b0cc0a04e2ba7d5f2fa836167e711bfb7af25;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index ba07f33..85d5a52 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -1201,7 +1201,7 @@ function _namespaceCleanup # these are things that have to be accessible post-cleanup for tmp in "$root" "$__SBINDIR" "$__PKGLIBDIR" "$vdir" \ - "$__PKGSTATEDIR" "${skip[@]}"; do + "$__PKGSTATEDIR" /usr/bin "${skip[@]}"; do while test -n "$tmp"; do list=( "${list[@]}" "$tmp" ) tmp="${tmp%/*}" @@ -1226,3 +1226,28 @@ function _namespaceCleanup done } +function loadDeviceMap +{ + local xid="$1" + local dir="$2" + local flags device target + + test -d "$dir" || return 0 + + for i in "$dir"/*; do + test -d "$i" || continue + + local -a vdevmap_opts=() + test -e "$i/create" && vdevmap_opts=( "${vdevmap_opts[@]}" --create ) + test -e "$i/open" && vdevmap_opts=( "${vdevmap_opts[@]}" --open ) + test -e "$i/remap" && vdevmap_opts=( "${vdevmap_opts[@]}" --remap ) + + getFileValue flags "$i/flags" || : + getFileValue device "$i/device" || : + getFileValue target "$i/target" || : + vdevmap_opts=( "${vdevmap_opts[@]}" ${flags:+--flags "$flags"} \ + ${device:+--device "$device"} ${target:+--target "$target"} ) + + $_VDEVMAP --xid "$xid" "${vdevmap_opts[@]}" || return $? + done +}