History log of /freebsd-current/stand/lua/config.lua.8
Revision Date Author Comments
# c475e61f 21-Dec-2023 Stéphane Rochoy <stephane.rochoy@stormshield.eu>

stand/lua: always allow overriding with local config files

Loader now also read configuration files listed in local_loader_conf_files.
Files listed here are the last ones read. And /boot/loader.conf.local was
moved from loader_conf_files to local_loader_conf_files leaving only
loader.conf and device.hints in loader_conf_files by default.

The idea is to ensure local_loader_conf_files, i.e., /boot/loader.conf.local,
can always be used to override other user defined settings.

So the sequencing is now as follow:

1. Bootstrap:
/boot/defaults/loader.conf

2. Read loader_conf_files files:
/boot/device.hints
/boot/loader.conf

3. Read loader_conf_dirs files:
/boot/loader.conf.d/*.conf

4. And finally, rread local_loader_conf_files files:
/boot/loader.conf.local

Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/759


# 5fdf01db 02-Feb-2024 Warner Losh <imp@FreeBSD.org>

Revert "stand/lua: always allow overriding with local config files"

This reverts commit d3d0b735571d9562812ce5b343a6e91f7a795dbe. no mail
sent out, and the commit message was wrong.

Sponsored by: Netflix


# d3d0b735 21-Dec-2023 Stéphane Rochoy <stephane.rochoy@stormshield.eu>

stand/lua: always allow overriding with local config files

Loader now also read configuration files listed in local_loader_conf_files.
Files listed here are the last ones read. And /boot/loader.conf.local was
moved from loader_conf_files to local_loader_conf_files leaving only
loader.conf and device.hints in loader_conf_files by default.

The idea is to ensure local_loader_conf_files, i.e., /boot/loader.conf.local,
can always be used to override other user defined settings.

So the sequencing is now as follow:

1. Bootstrap:
/boot/defaults/loader.conf

2. Read loader_conf_files files:
/boot/device.hints
/boot/loader.conf

3. Read loader_conf_dirs files:
/boot/loader.conf.d/*.conf

4. And finally, rread local_loader_conf_files files:
/boot/loader.conf.local


# fa9896e0 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line nroff pattern

Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 3cb2f5f3 10-May-2023 Kyle Evans <kevans@FreeBSD.org>

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


# 7ed84fa1 17-Dec-2020 Kyle Evans <kevans@FreeBSD.org>

lualoader: cli: provide a show-module-options loader command

This effectively dumps everything lualoader knows about to the console using
the libsa pager; that particular lua interface was added in r368591.

A pager stub implementation has been added that just dumps the output as-is
as a compat shim for older loader binaries that do not have lpager. This
stub should be moved into a more appropriate .lua file if we add anything
else that needs the pager.


# 4634bb1f 11-Dec-2020 Kyle Evans <kevans@FreeBSD.org>

lualoader: provide module-manipulation commands

Specifically, we have:
- enable-module
- disable-module
- toggle-module

These can be used to add/remove modules to be loaded or force modules to be
loaded in spite of modules_blacklist. In the typical case, a user is
expected to use them to recover an issue happening due to a module directive
they've added to their loader.conf or because they discover that they've
under-specified what to load.

MFC after: 1 week


# 3fe0ac6a 30-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

lualoader: config: improve readConfFiles, rename to readConf

The previous interface was pretty bad, and required the caller to get some
implementation details correct that it really shouldn't need to (e.g.
loader_conf_files handling) and pass in an empty table for it to use.

The new and much improved interface, readConf, is much less of a hack;
hiding these implementation details and just doing the right thing.
config.lua will now use it to process /boot/defaults/loader.conf and the
subsequent loader_conf_files from there, and read-conf will also use it.

This improvement submitted by Olivier (cited below), loader_conf_files
handling from the original patch was changed to just clobber it before
processing and not bother restoring it after the fact following r360505
where it's now guaranteed to evade the loader environment.

PR: 244640
Submitted by: Olivier Certner (olivier freebsd free fr>


# 60a2823c 27-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

config.lua(8): catch up to recently added hooks

While we're here, let's stylize these as functions instead of just raw text.
A future change may allow arbitrary data arguments to be passed some of
these, and the distinction is useful.


# aa3d34de 27-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

config.lua(8): "may should" is not proper grammar

Reported by: rpokala
X-MFC-With: r360421


# 7a5c6c8b 27-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

lualoader: config: start exporting readConfFiles

In the process, change it slightly: readConfFiles will take a string like
loader_conf_files in addition to the loaded_files table that it normally
takes. This is to facilitate the addition of a read-conf CLI command, which
will just pass in the single file to read and an empty table.

MFC after: 3 days


# 088b5ad3 19-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

Add config.lua(8) to the tree

Reviewed by: 0mp, rpokala (earlier version)
Differential Revision: https://reviews.freebsd.org/D14819