Date: Wed, 17 Aug 2022 15:54:47 +0200 From: Franco Fichtner <franco@opnsense.org> To: Mateusz Piotrowski <0mp@FreeBSD.org> Cc: Mariusz Zaborski <oshogbo@freebsd.org>, "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: c9be47b34dd8 - main - rc: add ${name}_setup script support Message-ID: <164CCE3E-355D-4F60-A88D-850B9A24B36E@opnsense.org> In-Reply-To: <D086BBF9-F211-447E-8C55-EBDBCF0B3E9B@FreeBSD.org> References: <202208151442.27FEgjSd083060@gitrepo.freebsd.org> <D086BBF9-F211-447E-8C55-EBDBCF0B3E9B@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <oshogbo@freebsd.org = <mailto:oshogbo@freebsd.org>> wrote: >>=20 >> The branch main has been updated by oshogbo: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc9be47b34dd847da1d4ab0feee4a6100= b2c5ea0d = <https://cgit.freebsd.org/src/commit/?id=3Dc9be47b34dd847da1d4ab0feee4a610= 0b2c5ea0d> >>=20 >> commit c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d >> Author: Franco Fichtner <franco@opnsense.org = <mailto:franco@opnsense.org>> >> AuthorDate: 2022-08-15 14:41:31 +0000 >> Commit: Mariusz Zaborski <oshogbo@FreeBSD.org = <mailto:oshogbo@FreeBSD.org>> >> 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 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 17. Aug 2022, at 15:33, Mateusz Piotrowski <<a = href=3D"mailto:0mp@FreeBSD.org" class=3D"">0mp@FreeBSD.org</a>> = wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta = http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" = class=3D""><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: = space; line-break: after-white-space;" class=3D"">Hey,<br class=3D""><div = class=3D""><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 15. Aug 2022, at 16:42, Mariusz Zaborski <<a = href=3D"mailto:oshogbo@freebsd.org" class=3D"">oshogbo@freebsd.org</a>>= wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div = class=3D"">The branch main has been updated by oshogbo:<br class=3D""><br = class=3D"">URL: <a = href=3D"https://cgit.freebsd.org/src/commit/?id=3Dc9be47b34dd847da1d4ab0fe= ee4a6100b2c5ea0d" = class=3D"">https://cgit.FreeBSD.org/src/commit/?id=3Dc9be47b34dd847da1d4ab= 0feee4a6100b2c5ea0d</a><br class=3D""><br class=3D"">commit = c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d<br class=3D"">Author: = Franco Fichtner <<a = href=3D"mailto:franco@opnsense.org" = class=3D"">franco@opnsense.org</a>><br class=3D"">AuthorDate: = 2022-08-15 14:41:31 +0000<br class=3D"">Commit: = Mariusz Zaborski <<a = href=3D"mailto:oshogbo@FreeBSD.org" = class=3D"">oshogbo@FreeBSD.org</a>><br class=3D"">CommitDate: = 2022-08-15 14:43:12 +0000<br class=3D""><br class=3D""> = rc: add ${name}_setup script support<br class=3D""><br = class=3D""> Run a service-based setup script before = running the start command.<br class=3D""> Useful for = automatic configuration file generation.<br class=3D""><br = class=3D""></div></div></blockquote><div class=3D""><br = class=3D""></div>Couldn't this be achieved with NAME_prepend? Here=E2=80=99= s an example:</div></div></div></blockquote><div><br = class=3D""></div><div>In the ports tree grep'ing for "_prepend=3D" I = find no match, in the source tree</div><div>the only relevant match is = rc.subr file describing it. I doubt there is much use</div><div>in = hidden work because of the convoluted semantics involved.</div><div><br = class=3D""></div><div>I don't want partial shell syntax in a RC variable = and it looks odd and is</div><div>eventually subject to the = implementation which could break it later on.</div><div><br = class=3D""></div><div><br = class=3D""></div><div>Cheers,</div><div>Franco</div><div><br = class=3D""></div><blockquote type=3D"cite" class=3D""><div class=3D""><div= style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; line-break: = after-white-space;" class=3D""><div class=3D""><div style=3D"margin: = 0px; font-stretch: normal; font-size: 13px; line-height: normal; = font-family: "Helvetica Neue";" class=3D""># sh -c = 'test_prepend=3D"/bin/echo \"generating files\" = &&=E2=80=9D; </div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 13px; line-height: normal; font-family: = "Helvetica Neue";" class=3D"">. /etc/rc.subr; = name=3Dtest; </div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 13px; line-height: normal; font-family: "Helvetica = Neue";" class=3D"">rcvar=3Dtest_enable; </div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 13px; = line-height: normal; font-family: "Helvetica Neue";" = class=3D"">command=3D"/bin/echo=E2=80=9D; </div><div style=3D"margin:= 0px; font-stretch: normal; font-size: 13px; line-height: normal; = font-family: "Helvetica Neue";" = class=3D"">command_args=3D"hello=E2=80=9D; </div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 13px; = line-height: normal; font-family: "Helvetica Neue";" = class=3D"">run_rc_command onestart=E2=80=99</div><div style=3D"margin: = 0px; font-stretch: normal; font-size: 13px; line-height: normal; = font-family: "Helvetica Neue";" class=3D""><br = class=3D""></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 13px; line-height: normal; font-family: "Helvetica = Neue";" class=3D"">The out will be:</div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 13px; line-height: normal; font-family: = "Helvetica Neue";" class=3D""><br class=3D""></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 13px; = line-height: normal; font-family: "Helvetica Neue";" = class=3D"">Starting test.</div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 13px; line-height: normal; font-family: = "Helvetica Neue";" class=3D"">generating files</div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 13px; = line-height: normal; font-family: "Helvetica Neue";" = class=3D"">hello</div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 13px; line-height: normal; font-family: "Helvetica = Neue";" class=3D""><br class=3D""></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 13px; line-height: normal; font-family: = "Helvetica Neue";" class=3D""><br class=3D""></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 13px; = line-height: normal; font-family: "Helvetica Neue";" = class=3D"">Best,</div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 13px; line-height: normal; font-family: "Helvetica = Neue";" = class=3D"">Mateusz</div></div></div></div></blockquote></div><br = class=3D""></body></html>= --Apple-Mail=_6823943E-4A67-45CE-9102-9142E41B0B51--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?164CCE3E-355D-4F60-A88D-850B9A24B36E>