Skip to content

Commit

Permalink
openrc-run.sh-in: Conditionally add configs.
Browse files Browse the repository at this point in the history
Conditionally add system provided configs for user services. The local
configs for the same services take priority.

Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
  • Loading branch information
navi-desu committed Mar 15, 2023
1 parent 77f5fe1 commit b9e20e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sh/openrc-run.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,26 @@ 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
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
Expand Down

0 comments on commit b9e20e8

Please sign in to comment.