aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-03-14 18:56:39 -0300
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-10-19 10:56:54 +0200
commitb80971ce08dd080529efaf694afc67846e0748b8 (patch)
tree923d5370bf03eb75539358f7e6ae2276c20a9cff /sh
parent7316f00442ff3c95cb89f8666a468db777af61b6 (diff)
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 <navi@vlhl.dev>
Diffstat (limited to 'sh')
-rw-r--r--sh/openrc-run.sh.in28
1 files changed, 15 insertions, 13 deletions
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