aports/main/openrc/0010-openrc-run-Fix-loading-of-user-configs-for-system-su.patch

56 lines
2.1 KiB
Diff

From 028eadec44f6321652fede7fb6eae77b0131bd90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 16 Mar 2025 12:32:20 +0100
Subject: [PATCH] openrc-run: Fix loading of user configs for system-supplied
user services
Without this patch, OpenRC loads user configuration files for
system-supplied services from `~/.config/rc/$SERVICE` instead of
`~/.config/rc/conf.d/$SERVICE`. Since the latter is documented in the
user-guide, and used for user services not supplied by the system, I
believe it to be the correct location.
Note that the `_usr_conf_d` variable is probably a bit inappropriately
named as the similarly named `_conf_d` points to the system conf.d
directory while `_usr_conf_d` points to the base rc configuration
directory. Therefore, while at it, rename `_usr_conf_d` to `_usr_conf`
to avoid this confusion in the future.
This is a fixup for ae9d743207f27481efe2c80593eea51cd8742ab2.
---
sh/openrc-run.sh.in | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index c8e347dd..9939adf2 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -234,9 +234,9 @@ if [ -d "@SYSCONFDIR@/rc.conf.d" ]; then
done
fi
-_usr_conf_d=${XDG_CONFIG_HOME:-${HOME}/.config}/rc
+_usr_conf=${XDG_CONFIG_HOME:-${HOME}/.config}/rc
if yesno "$RC_USER_SERVICES"; then
- sourcex -e "$_usr_conf_d/rc.conf"
+ sourcex -e "$_usr_conf/rc.conf"
fi
_conf_d=${RC_SERVICE%/*}/../conf.d
@@ -255,12 +255,12 @@ if ! sourcex -e "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"; then
fi
unset _conf_d
-if yesno "$RC_USER_SERVICES" && [ $_usr_conf_d != ${RC_SERVICE%/*} ]; then
- if ! sourcex -e "$_usr_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"; then
- sourcex -e "$_usr_conf_d/$RC_SVCNAME"
+if yesno "$RC_USER_SERVICES" && [ "$_usr_conf/init.d" != "${RC_SERVICE%/*}" ]; then
+ if ! sourcex -e "$_usr_conf/conf.d/$RC_SVCNAME.$RC_RUNLEVEL"; then
+ sourcex -e "$_usr_conf/conf.d/$RC_SVCNAME"
fi
fi
-unset _usr_conf_d
+unset _usr_conf
# load service supervisor functions
sourcex "@LIBEXECDIR@/sh/runit.sh"