commit:     bb1bc6eeb73b3483a1ebdfc142a11240b58588cf
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Dec 14 18:44:45 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Dec 14 18:52:03 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=bb1bc6ee

local: misc cleanups

Remove references to @SYSCONFDIR@ since these can be calculated at
runtime.
Also style fixes.

 init.d/local.in | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/init.d/local.in b/init.d/local.in
index 001a4fb1..2bb1696c 100644
--- a/init.d/local.in
+++ b/init.d/local.in
@@ -9,7 +9,10 @@
 # This file may not be copied, modified, propagated, or distributed
 # except according to the terms contained in the LICENSE file.
 
-description="Executes user programs in @SYSCONFDIR@/local.d"
+conf_d_dir="${RC_SERVICE%/*/*}/conf.d"
+local_d_dir="${RC_SERVICE%/*/*}/local.d"
+
+description="Executes user programs in ${local_d_dir}"
 
 depend()
 {
@@ -19,12 +22,12 @@ depend()
 
 start()
 {
-       ebegin "Starting local"
-
-       local file has_errors=0 redirect retval
+       local file has_errors redirect retval
+       has_errors=0
        yesno $rc_verbose || redirect='> /dev/null 2>&1'
+       ebegin "Starting local"
        eindent
-       for file in @SYSCONFDIR@/local.d/*.start; do
+       for file in "${local_d_dir}"/*.start; do
                if [ -x "${file}" ]; then
                        vebegin "Executing \"${file}\""
                        eval "${file}" $redirect
@@ -38,32 +41,32 @@ start()
        eoutdent
 
        if command -v local_start >/dev/null 2>&1; then
-               ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed."
+               ewarn "\"${conf_d_dir}/local\" should be removed."
                ewarn "Please move the code from the local_start function"
                ewarn "to executable scripts with an .start extension"
-               ewarn "in \"@SYSCONFDIR@/local.d\""
+               ewarn "in \"${local_d_dir}\""
                local_start
        fi
 
        eend ${has_errors}
 
        # We have to end with a zero exit code, because a failed execution
-       # of an executable @SYSCONFDIR@/local.d/*.start file shouldn't result in
+       # of an executable ${local_d_dir}/*.start file shouldn't result in
        # marking the local service as failed. Otherwise we are unable to
-       # execute any executable @SYSCONFDIR@/local.d/*.stop file, because a 
failed
+       # execute any executable ${local_d_dir}/*.stop file, because a failed
        # marked service cannot be stopped (and the stop function would
-       # actually call the executable @SYSCONFDIR@/local.d/*.stop file(s)).
+       # actually call the executable ${local_d_dir}/*.stop file(s)).
        return 0
 }
 
 stop()
 {
-       ebegin "Stopping local"
-
-       local file has_errors=0 redirect retval
+       local file has_errors redirect retval
+       has_errors=0
        yesno $rc_verbose || redirect='> /dev/null 2>&1'
+       ebegin "Stopping local"
        eindent
-       for file in @SYSCONFDIR@/local.d/*.stop; do
+       for file in "${local_d_dir}"/*.stop; do
                if [ -x "${file}" ]; then
                        vebegin "Executing \"${file}\""
                        eval "${file}" $redirect
@@ -77,16 +80,16 @@ stop()
        eoutdent
 
        if command -v local_stop >/dev/null 2>&1; then
-               ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed."
+               ewarn "\"${conf_d_dir}/local\" should be removed."
                ewarn "Please move the code from the local_stop function"
                ewarn "to executable scripts with an .stop extension"
-               ewarn "in \"@SYSCONFDIR@/local.d\""
+               ewarn "in \"${local_d_dir}\""
                local_stop
        fi
 
        eend ${has_errors}
 
-       # An executable @SYSCONFDIR@/local.d/*.stop file which failed with a
+       # An executable ${local_d_dir}/*.stop file which failed with a
        # non-zero exit status is not a reason to mark this service
        # as failed, therefore we have to end with a zero exit code.
        return 0

Reply via email to