aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2011-07-27 11:02:23 -0500
committerWilliam Hubbs <williamh@gentoo.org>2011-07-31 10:00:48 -0500
commit0c8bea21524c22856fdb8528298b43d6fb20451d (patch)
tree244f29d5dc4e034dae2f7f4860182ae3df2f4574 /sh
parent3688c851636c9458eb88c7469bb374e5f6d0f9de (diff)
Improve processing of service directories and conf.d files
symbolic links should not be followed in an attempt to work out the name of the service we are running. Also, @sysconfdir@/conf.d should be tried as a backup directory for configuration files. I would like to thank Robin Johnson for his input on this change. X-Gentoo-Bug: 350910 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=350910
Diffstat (limited to 'sh')
-rw-r--r--sh/runscript.sh.in33
1 files changed, 19 insertions, 14 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index df34b5e5..fe30a039 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -16,6 +16,23 @@ sourcex()
fi
}
+loadconfig()
+{
+ # If we're net.eth0 or openvpn.work then load net or openvpn config
+ _c=${RC_SVCNAME%%.*}
+ if [ -n "$_c" -a "$_c" != "$RC_SVCNAME" ]; then
+ if ! sourcex -e "$1/$_c.$RC_RUNLEVEL"; then
+ sourcex -e "$1/$_c"
+ fi
+ fi
+ unset _c
+
+ # Overlay with our specific config
+ if ! sourcex -e "$1/$RC_SVCNAME.$RC_RUNLEVEL"; then
+ sourcex -e "$1/$RC_SVCNAME"
+ fi
+}
+
if [ ! -e ${RC_SVCDIR}/softlevel ]; then
eerror "You are attempting to run an openrc service on a"
eerror "system which openrc did not boot."
@@ -165,21 +182,9 @@ status()
yesno $RC_DEBUG && set -x
-_conf_d=${RC_SERVICE%/*}/../conf.d
-# If we're net.eth0 or openvpn.work then load net or openvpn config
-_c=${RC_SVCNAME%%.*}
-if [ -n "$_c" -a "$_c" != "$RC_SVCNAME" ]; then
- if ! sourcex -e "$_conf_d/$_c.$RC_RUNLEVEL"; then
- sourcex -e "$_conf_d/$_c"
- fi
-fi
-unset _c
-
-# Overlay with our specific config
-if ! sourcex -e "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"; then
- sourcex -e "$_conf_d/$RC_SVCNAME"
+if ! loadconfig "${RC_SERVICE%/*}/../conf.d"; then
+ loadconfig "@SYSCONFDIR@/conf.d"
fi
-unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"