X-Original-To: alpine-aports@lists.alpinelinux.org Received: from mail-vk0-f50.google.com (mail-vk0-f50.google.com [209.85.213.50]) by lists.alpinelinux.org (Postfix) with ESMTP id 90DBF5C43B6 for ; Fri, 24 Feb 2017 19:56:34 +0000 (GMT) Received: by mail-vk0-f50.google.com with SMTP id k127so17557619vke.0 for ; Fri, 24 Feb 2017 11:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sxX65b1qH4ZnWjiKQuZmX0gYlmnNXaRS+ocWc8Lhavk=; b=shj972jzgPITa0QjcIJjWVcEOApS+GPrrQEHh9LVpHZANopc2LuefZBxGpNjA+KSCI 3clKIWFdToPBBiE3pBmrPa03NivguWkcTFSBzN5/GDPl2S2fqnVa2mTSdy23VmumsVLA uEAOs/T+FKqrtTH2ktACU5BA8xep86XqiOreoUhvaK2F/eWzs4FD7OFwgfD65gp5TPLm DehJZMjQXziKwe1Vkpu684WEx7CcOALg740Qbs8trvv34cLcoZtvpfi4vJB7Y/hgOQFu 4bIyGP4CTtJlUMWUTxq1KYxoN/fq43vDZuxdCnq3XxT9zGlmh+bGUtCV4fVZBZZosln7 EbxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sxX65b1qH4ZnWjiKQuZmX0gYlmnNXaRS+ocWc8Lhavk=; b=UFinXQmEHP/w32yhgKDRH/g2CmTyD/AjxZKXxYWq+3TACqK3dQ9o/snTAmNX3+fNtn hYIVOEdC8Pg6RqIcidVWetVY/VBwijjb4Lj8Pn5LKP0U0txEjlmTVl2rwDbZ9s4EL5e4 0++oFEYuWONSozoPjxrLZO0FF6CoxBxysl0GPrjR2gDTbqA4PI3m7Z9H5//wBmbvICaX j6JKsazmude4gATjXZYXW24D48bL0OZcUsZj3Rcv79Lpoo91O/pNx7oLezFeK9wRjvmB n8B313tzUa0xM+mvuOuMtH7uN5v7WC8eu0Uuwln+jyjca2JumONMKzqcbuu3JY4vofKK 7s1Q== X-Gm-Message-State: AMke39k4uN0eSTxq0KokOA4YQ/qGR63q0YBblwxI1IPlMQxaSJIBy6oBxT4U7LKhWcK4hzlED6hHF2lh6YcuCg== X-Received: by 10.31.47.85 with SMTP id v82mr2042602vkv.2.1487966193903; Fri, 24 Feb 2017 11:56:33 -0800 (PST) X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Received: by 10.31.140.138 with HTTP; Fri, 24 Feb 2017 11:56:33 -0800 (PST) In-Reply-To: <20170224164839.47bce33d@ncopa-desktop.copa.dup.pw> References: <20170224143718.22639-1-valery.kartel@gmail.com> <20170224164839.47bce33d@ncopa-desktop.copa.dup.pw> From: Valery Kartel Date: Fri, 24 Feb 2017 21:56:33 +0200 Message-ID: Subject: Re: [alpine-aports] [PATCH] testing/rspamd: upgrade to 1.4.4 To: Natanael Copa Cc: alpine-aports Content-Type: multipart/alternative; boundary=001a1143ff386cef9505494c20fa --001a1143ff386cef9505494c20fa Content-Type: text/plain; charset=UTF-8 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 : > On Fri, 24 Feb 2017 16:37:18 +0200 > Valery Kartel 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 > > @@ -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 > --001a1143ff386cef9505494c20fa Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Yes, it's a good idea, and sometimes useful.

Bu= t I think checkconfig() need to be just a wrapper for start_pre() covered w= ith user-friendly ebegin...eend.
Because start_pre() is an internal func= tion with silent code, but checkconfig is a user-called command with some s= marter output.

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

=3D=3D=3D
extra_c= ommands=3D"checkconfig"
description_checkconfig=3D"Verify= configuration file"
....
checkconfig() {
=C2=A0=C2=A0=C2=A0 = ebegin "Checking $RC_SVCNAME config"
=C2=A0=C2=A0=C2=A0 startu= plog=3D/dev/tty; start_pre
=C2=A0=C2=A0=C2=A0 eend $?
}
=3D=3D=3D<= br>
What do you think?

2017-02-24 17:48 GMT+02:00 Natanael Copa <ncopa@alpi= nelinux.org>:
On Fri, 24 Feb 2017 16:37:18 +0200
Valery Kartel <valery.kartel@= gmail.com> wrote:

> fixes in init script
> ---
>=C2=A0 testing/rspamd/APKBUILD=C2=A0 =C2=A0 =C2=A0| 18 +++-------------= --
>=C2=A0 testing/rspamd/rspamd.initd | 10 ++++------
>=C2=A0 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
> @@ -18,20 +18,18 @@ depend() {
>=C2=A0 }
>
>=C2=A0 start_pre() {
> -=C2=A0 =C2=A0 =C2=A0ebegin
> -=C2=A0 =C2=A0 =C2=A0checkpath --directory --mode 750 --owner $user:$g= roup ${pidfile%/*}
> +=C2=A0 =C2=A0 =C2=A0[ "$RC_CMD" =3D "start" ] &am= p;& checkpath -d -m 750 -o $user:$group ${pidfile%/*}
>=C2=A0 =C2=A0 =C2=A0 =C2=A0$command $command_args -t >/dev/null 2>= ;>${startuplog:-/dev/null}
> -=C2=A0 =C2=A0 =C2=A0eend $?
>=C2=A0 }
>
>=C2=A0 reload() {
> -=C2=A0 =C2=A0 =C2=A0ebegin "Reloading ${SVCNAME}"
> -=C2=A0 =C2=A0 =C2=A0start-stop-daemon --signal HUP --pidfile $pidfile=
> +=C2=A0 =C2=A0 =C2=A0ebegin "Reloading $RC_SVCNAME config" > +=C2=A0 =C2=A0 =C2=A0start_pre && start-stop-daemon --signal H= UP --pidfile $pidfile
>=C2=A0 =C2=A0 =C2=A0 =C2=A0eend $?
>=C2=A0 }
>
>=C2=A0 reopen() {
> -=C2=A0 =C2=A0 =C2=A0ebegin "Reopening ${SVCNAME} log files"=
> +=C2=A0 =C2=A0 =C2=A0ebegin "Reopening $RC_SVCNAME log files"= ;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0start-stop-daemon --signal USR1 --pidfile $p= idfile
>=C2=A0 =C2=A0 =C2=A0 =C2=A0eend $?
>=C2=A0 }


I would have prefered:

checkconfig() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $command $command_args -t >= /dev/null 2>>${startuplog:-/dev/null}
}

start_pre() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 checkpath --directory --mode 7= 50 --owner $user:$group ${pidfile%/*}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 checkconfig
}

reload() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ebegin "Reloading $RC_SVCNAME config"=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 checkconfig && start-stop-daemon --sign= al HUP --pidfile $pidfile
=C2=A0 =C2=A0 =C2=A0 =C2=A0 eend $?
}

-nc

--001a1143ff386cef9505494c20fa-- --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---