X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=a79a310ae2ba519dbfe9b5fe6d6bd108a59be3a9;hb=3a626a7f2cd15bca6a66d012f622a9c00c9fb5e0;hp=ee1751e8d2353781a00ba18acecc77e7a9354052;hpb=65600eead296f8d5f1c04f2cecb565baec7ac169;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index ee1751e..a79a310 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -355,7 +355,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 @@ -843,8 +843,11 @@ function prepareInit pushd "$1/vdir" >/dev/null case "$INITSTYLE" in sysv) - { $_FIND var/run ! -type d -print0; \ - $_FIND var/lock ! -type d -print0; } | xargs -0r $_CHROOT_SH rm + local -a dirs=( $($_CHROOT_SH realpath /var/run /var/lock | $_SED 's!^/*!!' || :) ) + local dir + for dir in "${dirs[@]}"; do + $_FIND $dir ! -type d -print0 | xargs -0r $_CHROOT_SH rm + done ;; plain) $_CHROOT_SH rm .autofsck forcefsck 2>/dev/null || : @@ -1413,11 +1416,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 @@ -1471,15 +1482,18 @@ function _generateCgroupOptions hasCgroup || return 0 - findFile file "$__CONFDIR/.defaults/cgroup/mnt" "" - if test -n "$file"; then - read CGROUP_MNT < "$file" - fi findFile file "$__CONFDIR/.defaults/cgroup/subsys" "" if test -n "$file"; then _readFileToArray CGROUP_SUBSYS "$file" else - CGROUP_SUBSYS=( $($_SED '/^#/d;/^ns[[:space:]]/d;s/[[:space:]].*//' /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 + read CGROUP_MNT < "$file" + elif test -d /sys/fs/cgroup -a -d /sys/fs/cgroup/"${CGROUP_SUBSYS[0]}"; then + CGROUP_MNT=/sys/fs/cgroup + CGROUP_MNT_PER_SS=1 fi findFile file "$__CONFDIR/.defaults/cgroup/inherit" "" if test -n "$file"; then