summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2011-12-11 01:18:08 -0600
committerWilliam Hubbs <williamh@gentoo.org>2011-12-11 01:18:08 -0600
commit5e01051c4eccf1fc52b32b060478a534d34769ed (patch)
treedcfb915b8986e62506f695cef7a38bdad854fe85 /sh
parent8ea1190486f9194bac9dfcb355021ebc8e8c15ce (diff)
downloadopenrc-5e01051c4eccf1fc52b32b060478a534d34769ed.tar.gz
openrc-5e01051c4eccf1fc52b32b060478a534d34769ed.tar.bz2
openrc-5e01051c4eccf1fc52b32b060478a534d34769ed.tar.xz
Allow init scripts to be executed with a relative path
This was a regression that was caused by the fix for http://bugs.gentoo.org/show_bug.cgi?id=350910. I am reverting the commit that we said fixed that bug and re-opening it. Reported-By: Nathaniel <nathaniel@paust.us X-Gentoo-Bug: 392457 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=392457
Diffstat (limited to 'sh')
-rw-r--r--sh/runscript.sh.in33
1 files changed, 14 insertions, 19 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 4032cb8..07f96d8 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -16,23 +16,6 @@ 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
-}
-
sourcex "@SYSCONFDIR@/init.d/functions.sh"
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
@@ -195,9 +178,21 @@ status()
yesno $RC_DEBUG && set -x
-if ! loadconfig "${RC_SERVICE%/*}/../conf.d"; then
- loadconfig "@SYSCONFDIR@/conf.d"
+_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"
fi
+unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"