aboutsummaryrefslogtreecommitdiff
path: root/stand/lua/core.lua.8
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2026-04-08 12:49:18 +0000
committerKyle Evans <kevans@FreeBSD.org>2026-04-13 14:43:16 +0000
commit9ef671ef0c6c50e85a35d867ef1c7890f9de91af (patch)
tree3a903e9b224938450b47ac8ada4deda406826144 /stand/lua/core.lua.8
parent42a8f973cb90fa40025586f083e7b13db7f81926 (diff)
lualoader: allow the local module to filter out the BE list
This allows something like the following local.lua to install a filter to implement its own notion of hidden BEs using a naming convention of a leading dot to hide them: -- file: /boot/lua/local.lua local core = require("core") local function be_hide(be) if core.isSingleUserBoot() then -- All BEs are accepted for single-user return true end local name = be:match("/([^/]+)$") if not name then -- Accept malformed BEs, for whatever reason return true end return name:match("^%.") == nil end if core.bootenvFilter then -- Just in case we need to be compatible with older versions of -- core.lua without the filtering functionality. core.bootenvFilter(be_hide) end -- EOF Requested by: Marek Zarychta Reviewed by: imp (cherry picked from commit bf0881060ecd75ce79683b82ebcd4809eadf7cf5)
Diffstat (limited to 'stand/lua/core.lua.8')
-rw-r--r--stand/lua/core.lua.813
1 files changed, 12 insertions, 1 deletions
diff --git a/stand/lua/core.lua.8 b/stand/lua/core.lua.8
index de43d3e2b220..325320b2fce8 100644
--- a/stand/lua/core.lua.8
+++ b/stand/lua/core.lua.8
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 29, 2025
+.Dd April 8, 2026
.Dt CORE.LUA 8
.Os
.Sh NAME
@@ -164,6 +164,17 @@ is set in
kernels will be autodetected from the current system.
.It Fn core.bootenvDefault
Returns the default boot environment, nil if unset.
+.It Fn core.bootenvFilter func
+Installs a filter
+.Fa func
+into
+.Fn core.bootenvList .
+If the
+.Fa func
+returns true, then the boot environment is retained in the list.
+Otherwise, the boot environment is hidden.
+The old filter, if any, is returned to allow the caller to compose a filter on
+top of another filter.
.It Fn core.bootenvList
Returns a table of boot environments, or an empty table.
These will be picked up using the