From b80971ce08dd080529efaf694afc67846e0748b8 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Tue, 14 Mar 2023 18:56:39 -0300 Subject: openrc-run.sh.in: Disable cgroups for user services. Since user services run as the user that is starting them, they won't be able to make use of cgroups. Signed-off-by: Anna (navi) Figueiredo Gomes --- sh/openrc-run.sh.in | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'sh') diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in index c3b38107..ed565a46 100644 --- a/sh/openrc-run.sh.in +++ b/sh/openrc-run.sh.in @@ -271,23 +271,25 @@ for _cmd; do fi fi # Apply cgroups settings if defined - if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ] - then - if grep -qs /sys/fs/cgroup /proc/1/mountinfo + if [ "${RC_USER_SERVICES}" != "YES" ]; then + if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ] then - if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then - eerror "No permission to apply cgroup settings" - break + if grep -qs /sys/fs/cgroup /proc/1/mountinfo + then + if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then + eerror "No permission to apply cgroup settings" + break + fi fi + cgroup_add_service fi - cgroup_add_service + [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && + cgroup_set_limits + [ "$(command -v cgroup2_set_limits)" = "cgroup2_set_limits" ] && + [ "$_cmd" = start ] && + cgroup2_set_limits + break fi - [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && - cgroup_set_limits - [ "$(command -v cgroup2_set_limits)" = "cgroup2_set_limits" ] && - [ "$_cmd" = start ] && - cgroup2_set_limits - break fi done -- cgit v1.2.3