Date: Thu, 11 May 2023 07:22:49 -0600 From: Warner Losh <imp@bsdimp.com> To: Mark Johnston <markj@freebsd.org> Cc: Kyle Evans <kevans@freebsd.org>, src-committers <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: 3cb2f5f369ec - main - lualoader: add support for .lua configuration files Message-ID: <CANCZdfrcggo-mto5pcGP%2B%2B1QwLGuO2RUdPs3BfG80xP4uTXHQQ@mail.gmail.com> In-Reply-To: <ZFzrU2doEG3DZKrb@nuc> References: <202305110411.34B4BFEE047146@gitrepo.freebsd.org> <ZFzrU2doEG3DZKrb@nuc>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000039d63305fb6ae35c Content-Type: text/plain; charset="UTF-8" On Thu, May 11, 2023, 7:19 AM Mark Johnston <markj@freebsd.org> wrote: > On Thu, May 11, 2023 at 04:11:15AM +0000, Kyle Evans wrote: > > The branch main has been updated by kevans: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3cb2f5f369ecfd6d15aeff2b47e21866551a20de > > > > commit 3cb2f5f369ecfd6d15aeff2b47e21866551a20de > > Author: Kyle Evans <kevans@FreeBSD.org> > > AuthorDate: 2023-05-11 04:10:53 +0000 > > Commit: Kyle Evans <kevans@FreeBSD.org> > > CommitDate: 2023-05-11 04:10:53 +0000 > > > > lualoader: add support for .lua configuration files > > > > If a file is specified in loader_conf_files that ends in '.lua', > lualoader > > will now load and execute that file. These may be used in place of a > > traditional loader.conf to use more complicated logic, where some > values > > may be set based on others or based on the environment that the C > bits has > > left us with. > > > > Lua scripts are run in a limited environment. In particular, it does > not get > > access to any modules or, in-fact, anything except environment > variable. > > > > A config.buildenv hook has been added so that a local module can add > > whatever it may need to to the environment. > > > > When a global var is set in the lua script, it does not immediately > alter > > the loader environment. Instead, the script's environment is > initially > > empty and processed only if the whole script executes successfully. > > Effectively, a lua configuration file either takes effect or it does > not, > > an error will not leave it in a half-baked state. > > > > Reviewed by: bcr (manpages), imp > > Differential Revision: https://reviews.freebsd.org/D28450 > > Should this be in RELNOTES? It seems like a very useful feature. > Yes.... unless Kyle objects :) Warner > --00000000000039d63305fb6ae35c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" = class=3D"gmail_attr">On Thu, May 11, 2023, 7:19 AM Mark Johnston <<a hre= f=3D"mailto:markj@freebsd.org">markj@freebsd.org</a>> wrote:<br></div><b= lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px = #ccc solid;padding-left:1ex">On Thu, May 11, 2023 at 04:11:15AM +0000, Kyle= Evans wrote:<br> > The branch main has been updated by kevans:<br> > <br> > URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D3cb2f5f369ec= fd6d15aeff2b47e21866551a20de" rel=3D"noreferrer noreferrer" target=3D"_blan= k">https://cgit.FreeBSD.org/src/commit/?id=3D3cb2f5f369ecfd6d15aeff2b47e218= 66551a20de</a><br> > <br> > commit 3cb2f5f369ecfd6d15aeff2b47e21866551a20de<br> > Author:=C2=A0 =C2=A0 =C2=A0Kyle Evans <kevans@FreeBSD.org><br> > AuthorDate: 2023-05-11 04:10:53 +0000<br> > Commit:=C2=A0 =C2=A0 =C2=A0Kyle Evans <kevans@FreeBSD.org><br> > CommitDate: 2023-05-11 04:10:53 +0000<br> > <br> >=C2=A0 =C2=A0 =C2=A0lualoader: add support for .lua configuration files= <br> >=C2=A0 =C2=A0 =C2=A0<br> >=C2=A0 =C2=A0 =C2=A0If a file is specified in loader_conf_files that en= ds in '.lua', lualoader<br> >=C2=A0 =C2=A0 =C2=A0will now load and execute that file. These may be u= sed in place of a<br> >=C2=A0 =C2=A0 =C2=A0traditional loader.conf to use more complicated log= ic, where some values<br> >=C2=A0 =C2=A0 =C2=A0may be set based on others or based on the environm= ent that the C bits has<br> >=C2=A0 =C2=A0 =C2=A0left us with.<br> >=C2=A0 =C2=A0 =C2=A0<br> >=C2=A0 =C2=A0 =C2=A0Lua scripts are run in a limited environment. In pa= rticular, it does not get<br> >=C2=A0 =C2=A0 =C2=A0access to any modules or, in-fact, anything except = environment variable.<br> >=C2=A0 =C2=A0 =C2=A0<br> >=C2=A0 =C2=A0 =C2=A0A config.buildenv hook has been added so that a loc= al module can add<br> >=C2=A0 =C2=A0 =C2=A0whatever it may need to to the environment.<br> >=C2=A0 =C2=A0 =C2=A0<br> >=C2=A0 =C2=A0 =C2=A0When a global var is set in the lua script, it does= not immediately alter<br> >=C2=A0 =C2=A0 =C2=A0the loader environment. Instead, the script's e= nvironment is initially<br> >=C2=A0 =C2=A0 =C2=A0empty and processed only if the whole script execut= es successfully.<br> >=C2=A0 =C2=A0 =C2=A0Effectively, a lua configuration file either takes = effect or it does not,<br> >=C2=A0 =C2=A0 =C2=A0an error will not leave it in a half-baked state.<b= r> >=C2=A0 =C2=A0 =C2=A0<br> >=C2=A0 =C2=A0 =C2=A0Reviewed by:=C2=A0 =C2=A0 bcr (manpages), imp<br> >=C2=A0 =C2=A0 =C2=A0Differential Revision:=C2=A0 <a href=3D"https://rev= iews.freebsd.org/D28450" rel=3D"noreferrer noreferrer" target=3D"_blank">ht= tps://reviews.freebsd.org/D28450</a><br> <br> Should this be in RELNOTES?=C2=A0 It seems like a very useful feature.<br><= /blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">Yes..= .. unless Kyle objects :)</div><div dir=3D"auto"><br></div><div dir=3D"auto= ">Warner</div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote clas= s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad= ding-left:1ex"> </blockquote></div></div></div> --00000000000039d63305fb6ae35c--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrcggo-mto5pcGP%2B%2B1QwLGuO2RUdPs3BfG80xP4uTXHQQ>