Re: git: c9be47b34dd8 - main - rc: add ${name}_setup script support
- In reply to: Mateusz Piotrowski : "Re: git: c9be47b34dd8 - main - rc: add ${name}_setup script support"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Aug 2022 13:54:47 UTC
> 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