X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=77ca912b97af9272610a6c13c645e74d9de69e7a;hb=HEAD;hp=f528d30331592d8b3f8aaf593225530e1858f2ca;hpb=2198bce8b4e20700ca72473140980208d0937e9d;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index f528d30..77ca912 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -42,6 +42,7 @@ declare -a OPTS_VCONTEXT_CREATE=() declare -a OPTS_VCONTEXT_MIGRATE=() declare -a OPTS_VCONTEXT_ENTER=() OPT_VCONTEXT_CHROOT=--chroot +OPT_VCONTEXT_CLOSE_FD="" declare -a OPTS_VATTRIBUTE=( --flag fakeinit ) declare -a OPTS_VSCHED=() declare -a OPTS_ENV=() @@ -355,7 +356,7 @@ function _generateInitOptions ! isNumber "${RUNLEVEL_START:-3}" || INITCMD_PREPARE=( $_FAKE_RUNLEVEL "${RUNLEVEL_START:-3}" /var/run/utmp ) ;; - (xgentoo) + (xgentoo|xopenrc) test -n "$RUNLEVEL_START" || RUNLEVEL_START="default" RC_PATH=/usr/sbin:/usr/bin:/sbin:/bin @@ -467,6 +468,8 @@ function _generateChcontextOptions OPTS_VCONTEXT_CREATE=( $SILENT_OPT \ ${ctx:+--xid "$ctx"} ) + findFile file "$vdir"/keepfds "$__CONFDIR/.defaults/keepfds" "" + test -n "$file" || OPT_VCONTEXT_CLOSE_FD="--closefd" ## put '--secure' at front so that it can be overridden OPTS_VATTRIBUTE=( --secure --flag default "${OPTS_VATTRIBUTE[@]}" ) } @@ -1416,11 +1419,19 @@ function _namespaceCleanup done done + # keep cgroup mount points + list=( "${list[@]}" "${CGROUP_MNT}" ) + if test -n "$CGROUP_MNT_PER_SS"; then + for ss in "${CGROUP_SUBSYS[@]}"; do + list=( "${list[@]}" "${CGROUP_MNT}/${ss}" ) + done + fi + local -a list_umount while read -r dev path opts; do test -n "$path" || continue - for i in "$root" /dev /proc; do - path_dir="${path}/" + path_dir="${path}/" + for i in "$root" /dev /proc /sys; do test "${path_dir#${i}/}" != "${path_dir}" && continue 2 done for i in "${list[@]}" /; do @@ -1478,7 +1489,7 @@ function _generateCgroupOptions if test -n "$file"; then _readFileToArray CGROUP_SUBSYS "$file" else - CGROUP_SUBSYS=( $($_AWK '/^#/ { next; } $1 == "ns" { next; } $4 != "0" { printf "%s%s", s, $1; s=","; }' /proc/cgroups) ) + CGROUP_SUBSYS=( $($_AWK '/^#/ { next; } $1 == "ns" { next; } $4 != "0" { print $1; }' /proc/cgroups) ) fi findFile file "$__CONFDIR/.defaults/cgroup/mnt" "" if test -n "$file"; then