X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=e00ce74cc12b69ca2fc89bfb1a2a00c811be19f8;hb=17ff67ea057bc6e8bcd831341ee243348a9ee57d;hp=afc337ab73c0e2ebe8fb72206d7ad0065951df5f;hpb=710b574e268ecfa9705ac7c73332362da9563fbd;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index afc337a..e00ce74 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -843,9 +843,9 @@ function prepareInit pushd "$1/vdir" >/dev/null case "$INITSTYLE" in sysv) - local -a dirs=( $($_CHROOT_SH realpath /var/run /var/lock || :) ) + local -a dirs=( $($_CHROOT_SH realpath /var/run /var/lock | $_SED 's!^/*!!' || :) ) local dir - for dir in dirs; do + for dir in "${dirs[@]}"; do $_FIND $dir ! -type d -print0 | xargs -0r $_CHROOT_SH rm done ;; @@ -1474,15 +1474,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