From 7316f00442ff3c95cb89f8666a468db777af61b6 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Tue, 14 Mar 2023 18:54:43 -0300 Subject: 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 --- sh/openrc-run.sh.in | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sh') 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 -- cgit v1.2.3