X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id B5F8CDCBEB2 for ; Wed, 23 Dec 2015 13:09:29 +0000 (UTC) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 41E97DC12FE for ; Wed, 23 Dec 2015 13:09:28 +0000 (UTC) Received: by mail-wm0-f43.google.com with SMTP id l126so147496424wml.0 for ; Wed, 23 Dec 2015 05:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=WLkKXvRkOOr8V3L0FCCWdLSFGUjkYNRDgOlIuf85Ygg=; b=f32v5c9cQSgx2PFZGGztUSO9liHqX9XtB3ulRkFfpNwbFD6B6WQLwtst5zohClxyfr /E8wi2ur7XDX3pqAjixu2RYhs/j8EA/Rcmmyorkz0A9i/Tsq9Af44FGkd3atvtVGVp/i 1giQy5x1Py7ojL4RD06Zu7Y0yn/bLyh2AeAVx5adLkapLZqycqrhiLBhuWFeOdrOJFZo 55SqBcxuPwduYfa8adzscZRLZ6xqiPL4eTEIxTPMrN+GVWOBN7X1eFvdEYREz2hX7sKv qj8/YLBXAgcgpAsA7h7Y97E/jKElyyCB6cja/HMhQ3P1I2JiJ37yRFa4E4GHWlP5pcrH bD1Q== X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 X-Received: by 10.28.177.10 with SMTP id a10mr32669018wmf.4.1450876167470; Wed, 23 Dec 2015 05:09:27 -0800 (PST) Received: by 10.28.90.132 with HTTP; Wed, 23 Dec 2015 05:09:27 -0800 (PST) In-Reply-To: <20151223085016.278e3a92@vostro> References: <1450823874-24248-1-git-send-email-valery.kartel@gmail.com> <20151223085016.278e3a92@vostro> Date: Wed, 23 Dec 2015 15:09:27 +0200 Message-ID: Subject: Re: [alpine-aports] [PATCH] main/dovecot: new init-script with dovecot.instances support From: Valery Kartel To: Timo Teras Cc: alpine-aports@lists.alpinelinux.org Content-Type: multipart/alternative; boundary=001a114526be93475d0527906e55 X-Virus-Scanned: ClamAV using ClamSMTP --001a114526be93475d0527906e55 Content-Type: text/plain; charset=UTF-8 > This is not equivalent to what it used to be: > DOVECOT_CONF=/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf .... old init-script cuts a part of init name after last dot and think it's a dovecot instance suffix. if I rename my init script to something like '/etc/init.d/happy.new.fear', it's would set DOVECOT_CONF to /etc/dovecot/dovecot.fear.conf I think it's have no sence. I just correct an init script to find the correct config file. 1. if we have declared non-empty DOVECOT_CONF in /etc/conf.d/${SVCNAME}, we use it as a config file name. 2. if haven't - we use ${SVCNAME} as a name of config file. so if the init script name is 'dovecot', the config file name would be '/etc/dovecot/dovecot.conf' (if DOVECOT_CONF is not set) and if the script name is 'jack.daniels' the config file name would be '/etc/dovecot/jack.daniels.conf' not '/etc/dovecot/dovecot.daniels.conf' 2015-12-23 8:50 GMT+02:00 Timo Teras : > On Wed, 23 Dec 2015 00:37:54 +0200 > Valery Kartel wrote: > > > --- > > main/dovecot/dovecot.initd | 49 > > +++++++++++----------------------------------- 1 file changed, 11 > > insertions(+), 38 deletions(-) > > > > diff --git a/main/dovecot/dovecot.initd b/main/dovecot/dovecot.initd > > index 880a39f..944ff87 100644 > > --- a/main/dovecot/dovecot.initd > > +++ b/main/dovecot/dovecot.initd > > @@ -1,9 +1,12 @@ > > #!/sbin/openrc-run > > > > description="Secure POP3/IMAP server" > > -description_reload="Reload configuration" > > - > > +cfgfile=/etc/dovecot/${SVCNAME}.conf > > This is not equivalent to what it used to be: > DOVECOT_CONF=/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf > or > DOVECOT_CONF=/etc/dovecot/dovecot.conf > > I wonder if this is acceptable. > > Otherwise it looks good to me. But should probably also be flattened to > the dovecot upgrade commit. > > Thanks. > > > +pidfile=$(/usr/bin/doveconf -c $cfgfile -h base_dir > > 2>/dev/null)/master.pid +command=/usr/sbin/dovecot > > +required_files=$cfgfile > > extra_started_commands="reload" > > +description_reload="Reload configuration" > > > > depend() { > > need localmount net > > @@ -12,46 +15,16 @@ depend() { > > use logger > > } > > > > -checkconfig() { > > - DOVECOT_INSTANCE=${SVCNAME##*.} > > - if [ -n "${DOVECOT_INSTANCE}" -a "${SVCNAME}" != "dovecot" > > ]; then > > - > > DOVECOT_CONF=/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf > > - else > > - DOVECOT_CONF=/etc/dovecot/dovecot.conf > > - fi > > - if [ ! -e ${DOVECOT_CONF} ]; then > > - eerror "You will need an ${DOVECOT_CONF} first" > > - return 1 > > - fi > > - if [ -x /usr/sbin/dovecot ]; then > > - DOVECOT_BASEDIR=$(/usr/sbin/dovecot -c > > ${DOVECOT_CONF} -a | grep '^base_dir = ' | sed 's/^base_dir = //') > > - else > > - eerror "dovecot not executable" > > - return 1 > > - fi > > - DOVECOT_BASEDIR=${DOVECOT_BASEDIR:-/run/dovecot} > > - DOVECOT_PIDFILE=${DOVECOT_BASEDIR}/master.pid > > - checkpath --directory --owner dovecot:dovecot --mode 0755 \ > > - ${DOVECOT_BASEDIR} > > -} > > - > > -start() { > > - checkconfig || return 1 > > - ebegin "Starting ${SVCNAME}" > > - start-stop-daemon --start --exec /usr/sbin/dovecot --pidfile > > "${DOVECOT_PIDFILE}" -- -c "${DOVECOT_CONF}" > > - eend $? > > -} > > - > > -stop() { > > - checkconfig || return 1 > > - ebegin "Stopping ${SVCNAME}" > > - start-stop-daemon --stop --exec /usr/sbin/dovecot --pidfile > > "${DOVECOT_PIDFILE}" +start_pre() { > > + ebegin > > + [ "$cfgfile" = "/etc/dovecot/dovecot.conf" ] || > > command_args="-c $cfgfile" > > + checkpath --directory ${pidfile%/*} > > + $command $command_args -a > /dev/null > > eend $? > > } > > > > reload() { > > - checkconfig || return 1 > > ebegin "Reloading ${SVCNAME} configs and restarting > > auth/login processes" > > - start-stop-daemon --signal HUP --exec /usr/sbin/dovecot > > --pidfile "${DOVECOT_PIDFILE}" > > + start_pre && start-stop-daemon --signal HUP --exec $command > > --pidfile $pidfile eend $? > > } > > --001a114526be93475d0527906e55 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
> This is not equivalent to what it used to be:
>=C2=A0 DOVECOT_CONF=3D/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf ...= .

old init-script cuts a part of init name after last dot and = think it's a dovecot instance suffix.
if I rename my init scri= pt to something like '/etc/init.d/happy.new.fear', it's would s= et DOVECOT_CONF to /etc/dovecot/dovecot.fear.conf
I think it's= have no sence. I just correct an init script to find the correct config fi= le.
1. if we have declared non-empty DOVECOT_CONF in /etc/conf.d/$= {SVCNAME}, we use it as a config file name.
2. if haven't - we= use ${SVCNAME} as a name of config file.

so if the init scrip= t name is 'dovecot', the config file name would be '/etc/doveco= t/dovecot.conf' (if DOVECOT_CONF is not set)
and if the script= name is 'jack.daniels' the config file name would be '/etc/dov= ecot/jack.daniels.conf' not '/etc/dovecot/dovecot.daniels.conf'=


201= 5-12-23 8:50 GMT+02:00 Timo Teras <timo.teras@iki.fi>:
On Wed, 23 Dec 2015 00:37:54 = +0200
Valery Kartel <valery.kartel@= gmail.com> wrote:

> ---
>=C2=A0 main/dovecot/dovecot.initd | 49
> +++++++++++----------------------------------- 1 file changed, 11
> insertions(+), 38 deletions(-)
>
> diff --git a/main/dovecot/dovecot.initd b/main/dovecot/dovecot.initd > index 880a39f..944ff87 100644
> --- a/main/dovecot/dovecot.initd
> +++ b/main/dovecot/dovecot.initd
> @@ -1,9 +1,12 @@
>=C2=A0 #!/sbin/openrc-run
>
>=C2=A0 description=3D"Secure POP3/IMAP server"
> -description_reload=3D"Reload configuration"
> -
> +cfgfile=3D/etc/dovecot/${SVCNAME}.conf

This is not equivalent to what it used to be:
=C2=A0 DOVECOT_CONF=3D/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf
or
=C2=A0 DOVECOT_CONF=3D/etc/dovecot/dovecot.conf

I wonder if this is acceptable.

Otherwise it looks good to me. But should probably also be flattened to
the dovecot upgrade commit.

Thanks.

> +pidfile=3D$(/usr/bin/doveconf -c $cfgfile -h base_dir
> 2>/dev/null)/master.pid +command=3D/usr/sbin/dovecot
> +required_files=3D$cfgfile
>=C2=A0 extra_started_commands=3D"reload"
> +description_reload=3D"Reload configuration"
>
>=C2=A0 depend() {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0need localmount net
> @@ -12,46 +15,16 @@ depend() {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0use logger
>=C2=A0 }
>
> -checkconfig() {
> -=C2=A0 =C2=A0 =C2=A0DOVECOT_INSTANCE=3D${SVCNAME##*.}
> -=C2=A0 =C2=A0 =C2=A0if [ -n "${DOVECOT_INSTANCE}" -a "= ${SVCNAME}" !=3D "dovecot"
> ]; then
> -
> DOVECOT_CONF=3D/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf
> -=C2=A0 =C2=A0 =C2=A0else
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DOVECOT_CONF=3D/etc/d= ovecot/dovecot.conf
> -=C2=A0 =C2=A0 =C2=A0fi
> -=C2=A0 =C2=A0 =C2=A0if [ ! -e ${DOVECOT_CONF} ]; then
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0eerror "You will= need an ${DOVECOT_CONF} first"
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1
> -=C2=A0 =C2=A0 =C2=A0fi
> -=C2=A0 =C2=A0 =C2=A0if [ -x /usr/sbin/dovecot ]; then
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DOVECOT_BASEDIR=3D$(/= usr/sbin/dovecot -c
> ${DOVECOT_CONF} -a | grep '^base_dir =3D ' | sed 's/^base_= dir =3D //')
> -=C2=A0 =C2=A0 =C2=A0else
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0eerror "dovecot = not executable"
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1
> -=C2=A0 =C2=A0 =C2=A0fi
> -=C2=A0 =C2=A0 =C2=A0DOVECOT_BASEDIR=3D${DOVECOT_BASEDIR:-/run/dovecot= }
> -=C2=A0 =C2=A0 =C2=A0DOVECOT_PIDFILE=3D${DOVECOT_BASEDIR}/master.pid > -=C2=A0 =C2=A0 =C2=A0checkpath --directory --owner dovecot:dovecot --m= ode 0755 \
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0${DOVECOT_BASEDIR} > -}
> -
> -start() {
> -=C2=A0 =C2=A0 =C2=A0checkconfig || return 1
> -=C2=A0 =C2=A0 =C2=A0ebegin "Starting ${SVCNAME}"
> -=C2=A0 =C2=A0 =C2=A0start-stop-daemon --start --exec /usr/sbin/doveco= t --pidfile
> "${DOVECOT_PIDFILE}" -- -c "${DOVECOT_CONF}"
> -=C2=A0 =C2=A0 =C2=A0eend $?
> -}
> -
> -stop() {
> -=C2=A0 =C2=A0 =C2=A0checkconfig || return 1
> -=C2=A0 =C2=A0 =C2=A0ebegin "Stopping ${SVCNAME}"
> -=C2=A0 =C2=A0 =C2=A0start-stop-daemon --stop --exec /usr/sbin/dovecot= --pidfile
> "${DOVECOT_PIDFILE}" +start_pre() {
> +=C2=A0 =C2=A0 =C2=A0ebegin
> +=C2=A0 =C2=A0 =C2=A0[ "$cfgfile" =3D "/etc/dovecot/dov= ecot.conf" ] ||
> command_args=3D"-c $cfgfile"
> +=C2=A0 =C2=A0 =C2=A0checkpath --directory ${pidfile%/*}
> +=C2=A0 =C2=A0 =C2=A0$command $command_args -a > /dev/null
>=C2=A0 =C2=A0 =C2=A0 =C2=A0eend $?
>=C2=A0 }
>
>=C2=A0 reload() {
> -=C2=A0 =C2=A0 =C2=A0checkconfig || return 1
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ebegin "Reloading ${SVCNAME} configs an= d restarting
> auth/login processes"
> -=C2=A0 =C2=A0 =C2=A0start-stop-daemon --signal HUP --exec /usr/sbin/d= ovecot
> --pidfile "${DOVECOT_PIDFILE}"
> +=C2=A0 =C2=A0 =C2=A0start_pre && start-stop-daemon --signal H= UP --exec $command
> --pidfile $pidfile eend $?
>=C2=A0 }


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