[arch-projects] [initscripts][PATCH] rc.d: Add error message when daemon script is not found
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> --- rc.d | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/rc.d b/rc.d index 55871b1..97f266a 100755 --- a/rc.d +++ b/rc.d @@ -52,7 +52,12 @@ case $1 in ENV+=" CONSOLE='${CONSOLE:-/dev/console}'" ENV+=" TERM='${TERM}'" for i; do - [[ -x "/etc/rc.d/$i" ]] && cd / && eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action" + if [[ -x "/etc/rc.d/$i" ]]; then + cd / + eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action" + else + printf "${C_OTHER}:: ${C_FAIL}Error: ${C_DONE}Daemon script $i does not exist.\n" + fi (( ret += !! $? )) # clamp exit value to 0/1 done esac -- 1.7.5.2
On Thu, May 26, 2011 at 10:07:23PM -0400, Eric Bélanger wrote:
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> --- rc.d | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/rc.d b/rc.d index 55871b1..97f266a 100755 --- a/rc.d +++ b/rc.d @@ -52,7 +52,12 @@ case $1 in ENV+=" CONSOLE='${CONSOLE:-/dev/console}'" ENV+=" TERM='${TERM}'" for i; do - [[ -x "/etc/rc.d/$i" ]] && cd / && eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action" + if [[ -x "/etc/rc.d/$i" ]]; then + cd / + eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action"
We need to get rid of this eval hackery and properly use an array for ENV.
+ else + printf "${C_OTHER}:: ${C_FAIL}Error: ${C_DONE}Daemon script $i does not exist.\n" + fi (( ret += !! $? )) # clamp exit value to 0/1 done esac -- 1.7.5.2
dave
participants (2)
-
Dave Reisner
-
Eric Bélanger