Page MenuHomeFreeBSD

lualoader: allow the local module to filter out the BE list
Needs ReviewPublic

Authored by kevans on Wed, Feb 18, 5:31 PM.
Tags
None
Referenced Files
F146470275: D55359.id.diff
Mon, Mar 2, 11:07 PM
Unknown Object (File)
Mon, Mar 2, 10:50 AM
Unknown Object (File)
Sun, Mar 1, 11:12 PM
Unknown Object (File)
Sun, Mar 1, 4:37 PM
Unknown Object (File)
Sun, Mar 1, 12:25 AM
Unknown Object (File)
Thu, Feb 26, 4:30 AM
Unknown Object (File)
Mon, Feb 23, 9:56 PM
Unknown Object (File)
Mon, Feb 23, 9:56 PM

Details

Reviewers
tsoome
imp
manu
Summary

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

core.bootenvFilter(be_hide)

  • EOF

Requested by: Marek Zarychta

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 70761
Build 67644: arc lint + arc unit

Event Timeline

Thank you for the effort to implement this as an official feature of the FreeBSD boot loader. This patch was tested on recent CURRENT and works fine for me.

The use case is simple - to hide some unneeded and protected boot environments from public view, while still allowing booting into them.