aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-03-14 18:54:43 -0300
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-10-19 10:56:54 +0200
commit7316f00442ff3c95cb89f8666a468db777af61b6 (patch)
tree83c58503231d31169e423790204fe98e03af1a4e /sh
parentc138f4bf100aca2abc630daf2b46713560c033d4 (diff)
openrc-run.sh-in: Conditionally add configs.
Conditionally add system provided configs for user services. The local configs for the same services take priority. Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'sh')
-rw-r--r--sh/openrc-run.sh.in11
1 files changed, 11 insertions, 0 deletions
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 5d0eeffa..c3b38107 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -222,8 +222,14 @@ fi
_conf_d=${RC_SERVICE%/*}/../conf.d
# If we're net.eth0 or openvpn.work then load net or openvpn config
+# In the case of user services, the local config has priority
_c=${RC_SVCNAME%%.*}
if [ -n "$_c" -a "$_c" != "$RC_SVCNAME" ]; then
+ if [ "${RC_USER_SERVICE}" = "YES" ]; then
+ if ! sourcex -e "@SYSCONFDIR@/conf.d/user.d/$_c.$RC_RUNLEVEL"; then
+ sourcex -e "@SYSCONFDIR@/conf.d/user.d/$_c"
+ fi
+ fi
if ! sourcex -e "$_conf_d/$_c.$RC_RUNLEVEL"; then
sourcex -e "$_conf_d/$_c"
fi
@@ -231,6 +237,11 @@ fi
unset _c
# Overlay with our specific config
+if [ "${RC_USER_SERVICE}" = "YES" ]; then
+ if ! sourcex -e "@SYSCONFDIR@/conf.d/user.d/$RC_SVCNAME.$RC_RUNLEVEL"; then
+ sourcex -e "@SYSCONFDIR@/conf.d/user.d/$RC_SVCNAME"
+ fi
+fi
if ! sourcex -e "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"; then
sourcex -e "$_conf_d/$RC_SVCNAME"
fi