Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102746034
D25608.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D25608.diff
View Options
diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist
--- a/etc/mtree/BSD.root.dist
+++ b/etc/mtree/BSD.root.dist
@@ -22,6 +22,8 @@
..
firmware
..
+ loader.conf.d tags=package=bootloader
+ ..
lua
..
kernel
diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf
--- a/stand/defaults/loader.conf
+++ b/stand/defaults/loader.conf
@@ -15,6 +15,7 @@
bootfile="kernel" # Kernel name (possibly absolute path)
kernel_options="" # Flags to be passed to the kernel
loader_conf_files="/boot/device.hints /boot/loader.conf /boot/loader.conf.local"
+loader_conf_dirs="/boot/loader.conf.d"
nextboot_conf="/boot/nextboot.conf"
verbose_loading="NO" # Set to YES for verbose loader output
diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5
--- a/stand/defaults/loader.conf.5
+++ b/stand/defaults/loader.conf.5
@@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
-.Dd April 29, 2020
+.Dd December 31, 2020
.Dt LOADER.CONF 5
.Os
.Sh NAME
@@ -87,6 +87,11 @@
so its use should be avoided.
Multiple instances of it will be processed
independently.
+.It Ar loader_conf_dirs
+Space separated list of directories to process for configuration files.
+The lua-based loader will process files with a
+.Dq .conf
+suffix that are placed in these directories.
.It Ar loader_conf_files
Defines additional configuration files to be processed right after the
present file.
@@ -252,6 +257,8 @@
Space or comma separated list of kernels to present in the boot menu.
.It Va loader_conf_files
.Pq Dq Pa /boot/loader.conf /boot/loader.conf.local
+.It Va loader_conf_dirs
+.Pq Dq Pa /boot/loader.conf.d
.It Va splash_bmp_load
.Pq Dq NO
If set to
diff --git a/stand/lua/config.lua b/stand/lua/config.lua
--- a/stand/lua/config.lua
+++ b/stand/lua/config.lua
@@ -39,6 +39,7 @@
-- Values to restore env to (nil to unset)
local env_restore = {}
+local MSG_FAILDIR = "Failed to load conf dir '%s': not a directory"
local MSG_FAILEXEC = "Failed to exec '%s'"
local MSG_FAILSETENV = "Failed to '%s' with value: %s"
local MSG_FAILOPENCFG = "Failed to open config: '%s'"
@@ -506,6 +507,8 @@
return
end
+ -- We'll process loader_conf_dirs at the top-level readConf
+ local load_conf_dirs = next(loaded_files) == nil
print("Loading " .. file)
-- The final value of loader_conf_files is not important, so just
@@ -529,6 +532,27 @@
config.readConf(name, loaded_files)
end
end
+
+ if load_conf_dirs then
+ local loader_conf_dirs = getEnv("loader_conf_dirs")
+ if loader_conf_dirs ~= nil then
+ for name in loader_conf_dirs:gmatch("[%w%p]+") do
+ if lfs.attributes(name, "mode") ~= "directory" then
+ print(MSG_FAILDIR:format(name))
+ goto nextdir
+ end
+ for cfile in lfs.dir(name) do
+ if cfile:match(".conf$") then
+ local fpath = name .. "/" .. cfile
+ if lfs.attributes(fpath, "mode") == "file" then
+ config.readConf(fpath, loaded_files)
+ end
+ end
+ end
+ ::nextdir::
+ end
+ end
+ end
end
-- other_kernel is optionally the name of a kernel to load, if not the default
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 3:36 PM (21 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14681635
Default Alt Text
D25608.diff (3 KB)
Attached To
Mode
D25608: First cut at a loader.conf.d support
Attached
Detach File
Event Timeline
Log In to Comment