Re: git: c9be47b34dd8 - main - rc: add ${name}_setup script support
Date: Wed, 17 Aug 2022 13:33:54 UTC
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