From nobody Wed Aug 17 13:54:47 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M78f81mYqz4ZWJC; Wed, 17 Aug 2022 13:54:56 +0000 (UTC) (envelope-from franco@opnsense.org) Received: from mail.opnsense.org (mail.opnsense.org [81.171.24.236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4M78f812whz3Hcd; Wed, 17 Aug 2022 13:54:56 +0000 (UTC) (envelope-from franco@opnsense.org) Received: from localhost (mail.opnsense.org [127.0.0.1]) by mail.opnsense.org (Postfix) with ESMTP id 5115A15517D; Wed, 17 Aug 2022 15:54:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.opnsense.org Received: from mail.opnsense.org ([127.0.0.1]) by localhost (mail.opnsense.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0pamT6egvBKK; Wed, 17 Aug 2022 15:54:49 +0200 (CEST) From: Franco Fichtner DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opnsense.org; s=dkim; t=1660744489; bh=tj1Mf/wj1p0+7gbK11FZFnPON9XkePPkySdwm/66mqU=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=RuXGnPka2VTztXXXQ/rWHbqMb62RkKSnXlUdorELOoulRzZI9loixQ8E2XdCeHXqW l1H/VziRFwVAUR1CjwMT7c4/4T7Ji09UIDfYWkx/MOfx67/ea8uW2N+/DBj+AcAq/8 LczPJ3kU4ubHkaQJUUcTPRKju3hAk37R5+yDXkPc= Message-Id: <164CCE3E-355D-4F60-A88D-850B9A24B36E@opnsense.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_6823943E-4A67-45CE-9102-9142E41B0B51" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: c9be47b34dd8 - main - rc: add ${name}_setup script support Date: Wed, 17 Aug 2022 15:54:47 +0200 In-Reply-To: Cc: Mariusz Zaborski , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Mateusz Piotrowski <0mp@FreeBSD.org> References: <202208151442.27FEgjSd083060@gitrepo.freebsd.org> X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Rspamd-Queue-Id: 4M78f812whz3Hcd X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_6823943E-4A67-45CE-9102-9142E41B0B51 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 17. Aug 2022, at 15:33, Mateusz Piotrowski <0mp@FreeBSD.org> wrote: >=20 > Hey, >=20 >> On 15. Aug 2022, at 16:42, Mariusz Zaborski > wrote: >>=20 >> The branch main has been updated by oshogbo: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc9be47b34dd847da1d4ab0feee4a6100= b2c5ea0d = >>=20 >> commit c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d >> Author: Franco Fichtner > >> AuthorDate: 2022-08-15 14:41:31 +0000 >> Commit: Mariusz Zaborski > >> CommitDate: 2022-08-15 14:43:12 +0000 >>=20 >> rc: add ${name}_setup script support >>=20 >> Run a service-based setup script before running the start command. >> Useful for automatic configuration file generation. >>=20 >=20 > Couldn't this be achieved with NAME_prepend? Here=E2=80=99s an = example: In the ports tree grep'ing for "_prepend=3D" I find no match, in the = source tree the only relevant match is rc.subr file describing it. I doubt there is = much use in hidden work because of the convoluted semantics involved. I don't want partial shell syntax in a RC variable and it looks odd and = is eventually subject to the implementation which could break it later on. Cheers, Franco > # sh -c 'test_prepend=3D"/bin/echo \"generating files\" &&=E2=80=9D;=20= > . /etc/rc.subr; name=3Dtest;=20 > rcvar=3Dtest_enable;=20 > command=3D"/bin/echo=E2=80=9D;=20 > command_args=3D"hello=E2=80=9D;=20 > run_rc_command onestart=E2=80=99 >=20 > The out will be: >=20 > Starting test. > generating files > hello >=20 >=20 > Best, > Mateusz --Apple-Mail=_6823943E-4A67-45CE-9102-9142E41B0B51 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 17. Aug 2022, at 15:33, Mateusz Piotrowski <0mp@FreeBSD.org> = wrote:

Hey,

On 15. Aug 2022, at 16:42, Mariusz Zaborski <oshogbo@freebsd.org>= wrote:

The branch main has been updated by oshogbo:

URL: https://cgit.FreeBSD.org/src/commit/?id=3Dc9be47b34dd847da1d4ab= 0feee4a6100b2c5ea0d

commit = c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d
Author: =     Franco Fichtner <franco@opnsense.org>
AuthorDate: = 2022-08-15 14:41:31 +0000
Commit: =     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: = 2022-08-15 14:43:12 +0000

=    rc: add ${name}_setup script support

   Run a service-based setup script before = running the start command.
   Useful for = automatic configuration file generation.


Couldn't this be achieved with NAME_prepend? Here=E2=80=99= s an example:

In the ports tree grep'ing for "_prepend=3D" I = find no match, in the source tree
the only relevant match is = rc.subr file describing it. I doubt there is much use
in = hidden work because of the convoluted semantics involved.

I don't want partial shell syntax in a RC variable = and it looks odd and is
eventually subject to the = implementation which could break it later on.


Cheers,
Franco

# sh -c = 'test_prepend=3D"/bin/echo \"generating files\" = &&=E2=80=9D; 
. /etc/rc.subr; = name=3Dtest; 
rcvar=3Dtest_enable; 
command=3D"/bin/echo=E2=80=9D; 
command_args=3D"hello=E2=80=9D; 
run_rc_command onestart=E2=80=99

The out will be:

Starting test.
generating files
hello


Best,
Mateusz

= --Apple-Mail=_6823943E-4A67-45CE-9102-9142E41B0B51--