Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2022 15:33:54 +0200
From:      Mateusz Piotrowski <0mp@FreeBSD.org>
To:        Mariusz Zaborski <oshogbo@freebsd.org>, franco@opnsense.org
Cc:        "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:  <D086BBF9-F211-447E-8C55-EBDBCF0B3E9B@FreeBSD.org>
In-Reply-To: <202208151442.27FEgjSd083060@gitrepo.freebsd.org>
References:  <202208151442.27FEgjSd083060@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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=c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d
> 
> 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’s an example:


# 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="">Hey,<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 15. Aug 2022, at 16:42, Mariusz Zaborski &lt;<a href="mailto:oshogbo@freebsd.org" class="">oshogbo@freebsd.org</a>&gt; 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: &nbsp;&nbsp;&nbsp;&nbsp;Franco Fichtner &lt;<a href="mailto:franco@opnsense.org" class="">franco@opnsense.org</a>&gt;<br class="">AuthorDate: 2022-08-15 14:41:31 +0000<br class="">Commit: &nbsp;&nbsp;&nbsp;&nbsp;Mariusz Zaborski &lt;<a href="mailto:oshogbo@FreeBSD.org" class="">oshogbo@FreeBSD.org</a>&gt;<br class="">CommitDate: 2022-08-15 14:43:12 +0000<br class=""><br class=""> &nbsp;&nbsp;&nbsp;rc: add ${name}_setup script support<br class=""><br class=""> &nbsp;&nbsp;&nbsp;Run a service-based setup script before running the start command.<br class=""> &nbsp;&nbsp;&nbsp;Useful for automatic configuration file generation.<br class=""><br class=""></div></div></blockquote><div><br class=""></div>Couldn't this be achieved with NAME_prepend? Here’s an example:</div><div><br class=""></div><div><br class=""></div><div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class=""># sh -c 'test_prepend="/bin/echo \"generating files\" &amp;&amp;”;&nbsp;</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">. /etc/rc.subr; name=test;&nbsp;</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">rcvar=test_enable;&nbsp;</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">command="/bin/echo”;&nbsp;</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">command_args="hello”;&nbsp;</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">run_rc_command onestart’</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">The out will be:</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">Starting test.</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">generating files</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">hello</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">Best,</div><div style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: &quot;Helvetica Neue&quot;;" class="">Mateusz</div></div></body></html>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D086BBF9-F211-447E-8C55-EBDBCF0B3E9B>