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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] > 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 <mailto:oshogbo@freebsd.org>> wrote: >> >> The branch main has been updated by oshogbo: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d <https://cgit.freebsd.org/src/commit/?id=c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d> >> >> 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 >> >> 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’s an example: In the ports tree grep'ing for "_prepend=" 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="/bin/echo \"generating files\" &&”; > . /etc/rc.subr; name=test; > rcvar=test_enable; > command="/bin/echo”; > command_args="hello”; > run_rc_command onestart’ > > The out will be: > > Starting test. > generating files > hello > > > Best, > Mateusz [-- Attachment #2 --] <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 17. Aug 2022, at 15:33, Mateusz Piotrowski <<a href="mailto:0mp@FreeBSD.org" class="">0mp@FreeBSD.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hey,<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 15. Aug 2022, at 16:42, Mariusz Zaborski <<a href="mailto:oshogbo@freebsd.org" class="">oshogbo@freebsd.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">The branch main has been updated by oshogbo:<br class=""><br class="">URL: <a href="https://cgit.freebsd.org/src/commit/?id=c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d" class="">https://cgit.FreeBSD.org/src/commit/?id=c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d</a><br class=""><br class="">commit c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d<br class="">Author: Franco Fichtner <<a href="mailto:franco@opnsense.org" class="">franco@opnsense.org</a>><br class="">AuthorDate: 2022-08-15 14:41:31 +0000<br class="">Commit: Mariusz Zaborski <<a href="mailto:oshogbo@FreeBSD.org" class="">oshogbo@FreeBSD.org</a>><br class="">CommitDate: 2022-08-15 14:43:12 +0000<br class=""><br class=""> rc: add ${name}_setup script support<br class=""><br class=""> Run a service-based setup script before running the start command.<br class=""> Useful for automatic configuration file generation.<br class=""><br class=""></div></div></blockquote><div class=""><br class=""></div>Couldn't this be achieved with NAME_prepend? Here’s an example:</div></div></div></blockquote><div><br class=""></div><div>In the ports tree grep'ing for "_prepend=" 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=""></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=""></div><div><br class=""></div><div>Cheers,</div><div>Franco</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class=""># sh -c 'test_prepend="/bin/echo \"generating files\" &&”; </div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">. /etc/rc.subr; name=test; </div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">rcvar=test_enable; </div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">command="/bin/echo”; </div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">command_args="hello”; </div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">run_rc_command onestart’</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">The out will be:</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">Starting test.</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">generating files</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">hello</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">Best,</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";" class="">Mateusz</div></div></div></div></blockquote></div><br class=""></body></html>help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?164CCE3E-355D-4F60-A88D-850B9A24B36E>
