Mail archive
alpine-aports

Re: [alpine-aports] [PATCH] testing/rspamd: upgrade to 1.4.4

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Fri, 24 Feb 2017 21:56:33 +0200

Yes, it's a good idea, and sometimes useful.

But I think checkconfig() need to be just a wrapper for start_pre() covered
with user-friendly ebegin...eend.
Because start_pre() is an internal function with silent code, but
checkconfig is a user-called command with some smarter output.

so start_pre() would stay as-is and checkconfig would be added to
extra_commands list ... like this:

===
extra_commands="checkconfig"
description_checkconfig="Verify configuration file"
....
checkconfig() {
    ebegin "Checking $RC_SVCNAME config"
    startuplog=/dev/tty; start_pre
    eend $?
}
===

What do you think?

2017-02-24 17:48 GMT+02:00 Natanael Copa <ncopa_at_alpinelinux.org>:

> On Fri, 24 Feb 2017 16:37:18 +0200
> Valery Kartel <valery.kartel_at_gmail.com> wrote:
>
> > fixes in init script
> > ---
> > testing/rspamd/APKBUILD | 18 +++---------------
> > testing/rspamd/rspamd.initd | 10 ++++------
> > 2 files changed, 7 insertions(+), 21 deletions(-)
> >
>
> ...
>
> > diff --git a/testing/rspamd/rspamd.initd b/testing/rspamd/rspamd.initd
> > index 93148ccb4b..b0eb9b057a 100644
> > --- a/testing/rspamd/rspamd.initd
> > +++ b/testing/rspamd/rspamd.initd
> > _at__at_ -18,20 +18,18 @@ depend() {
> > }
> >
> > start_pre() {
> > - ebegin
> > - checkpath --directory --mode 750 --owner $user:$group ${pidfile%/*}
> > + [ "$RC_CMD" = "start" ] && checkpath -d -m 750 -o $user:$group
> ${pidfile%/*}
> > $command $command_args -t >/dev/null 2>>${startuplog:-/dev/null}
> > - eend $?
> > }
> >
> > reload() {
> > - ebegin "Reloading ${SVCNAME}"
> > - start-stop-daemon --signal HUP --pidfile $pidfile
> > + ebegin "Reloading $RC_SVCNAME config"
> > + start_pre && start-stop-daemon --signal HUP --pidfile $pidfile
> > eend $?
> > }
> >
> > reopen() {
> > - ebegin "Reopening ${SVCNAME} log files"
> > + ebegin "Reopening $RC_SVCNAME log files"
> > start-stop-daemon --signal USR1 --pidfile $pidfile
> > eend $?
> > }
>
>
> I would have prefered:
>
> checkconfig() {
> $command $command_args -t >/dev/null 2>>${startuplog:-/dev/null}
> }
>
> start_pre() {
> checkpath --directory --mode 750 --owner $user:$group ${pidfile%/*}
> checkconfig
> }
>
> reload() {
> ebegin "Reloading $RC_SVCNAME config"
> checkconfig && start-stop-daemon --signal HUP --pidfile $pidfile
> eend $?
> }
>
> -nc
>



---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Fri Feb 24 2017 - 21:56:33 GMT