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
--Apple-Mail=_D1204960-50CB-495A-BC4D-19B615AACE5D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hey, > On 15. Aug 2022, at 16:42, Mariusz Zaborski <oshogbo@freebsd.org> = wrote: >=20 > The branch main has been updated by oshogbo: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc9be47b34dd847da1d4ab0feee4a6100= b2c5ea0d >=20 > 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 >=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 Couldn't this be achieved with NAME_prepend? Here=E2=80=99s an example: # 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 The out will be: Starting test. generating files hello Best, Mateusz= --Apple-Mail=_D1204960-50CB-495A-BC4D-19B615AACE5D 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"">Hey,<br class=3D""><div><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><br class=3D""></div>Couldn't = this be achieved with NAME_prepend? Here=E2=80=99s an = example:</div><div><br class=3D""></div><div><br = class=3D""></div><div><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></body></html>= --Apple-Mail=_D1204960-50CB-495A-BC4D-19B615AACE5D--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D086BBF9-F211-447E-8C55-EBDBCF0B3E9B>