[arch-projects] [PATCH] Error on unknown daemon in DAEMONS array

Dan McGee dpmcgee at gmail.com
Mon Jul 18 10:55:06 EDT 2011


On Mon, Jul 18, 2011 at 9:02 AM, Dave Reisner <d at falconindy.com> wrote:
> On Mon, Jul 18, 2011 at 08:21:44AM -0500, Dan McGee wrote:
>> We silently skip the starting of unknown entries in DAEMONS rather than
>> give any sort of feedback to the user.
>>
>> Signed-off-by: Dan McGee <dan at archlinux.org>
>> ---
>>  functions |   12 ++++++++++--
>>  1 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/functions b/functions
>> index 1cfcf28..56d1689 100644
>> --- a/functions
>> +++ b/functions
>> @@ -204,7 +204,11 @@ ck_autostart() {
>>  }
>>
>>  start_daemon() {
>> -     have_daemon "$1" && /etc/rc.d/"$1" start
>> +     if [ have_daemon "$1" ]; then
>
>  bash: [: have_daemon: unary operator expected
>
> '[' is not part of if's syntax. if is a keyword that expects commands to
> follow, so its simply:
>
>  if have_daemon "$1"; then
Untested! Thanks and ack on the change, I should have realized this.

>
>> +             /etc/rc.d/"$1" start
>> +     else
>> +             printf "${C_FAIL}Warning:${C_CLEAR} Daemon named \'$1\' was not found.\n"
>> +     fi
>>  }
>>
>>  # Never use this function, it causes daemons to be stoped in the wrong order.
>> @@ -218,7 +222,11 @@ ck_depends() {
>>
>>  start_daemon_bkgd() {
>>       stat_bkgd "Starting $1"
>> -     have_daemon "$1" && (start_daemon "$1") &>/dev/null &
>> +     if [ have_daemon "$1" ]; then
>
> Same here.
>
>> +             (/etc/rc.d/"$1" start) &>/dev/null &
>> +     else
>> +             printf "${C_FAIL}Warning:${C_CLEAR} Daemon named \'$1\' was not found.\n"
>> +     fi
>>  }
>>
>>  stop_daemon() {
>> --
>> 1.7.6
>>
>


More information about the arch-projects mailing list