Page MenuHomeFreeBSD

D25608.id74270.diff
No OneTemporary

D25608.id74270.diff

Index: etc/mtree/BSD.root.dist
===================================================================
--- etc/mtree/BSD.root.dist
+++ etc/mtree/BSD.root.dist
@@ -22,6 +22,8 @@
..
firmware
..
+ loader.conf.d tags=package=bootloader
+ ..
lua
..
kernel
Index: stand/defaults/loader.conf
===================================================================
--- stand/defaults/loader.conf
+++ 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"
nextboot_enable="NO"
verbose_loading="NO" # Set to YES for verbose loader output
Index: stand/defaults/loader.conf.5
===================================================================
--- stand/defaults/loader.conf.5
+++ stand/defaults/loader.conf.5
@@ -253,6 +253,11 @@
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
+Space separated list of directories to process for configuration files.
+Any files contained inside will be processed, regardless of the naming
+convention.
.It Va splash_bmp_load
.Pq Dq NO
If set to
Index: stand/lua/config.lua
===================================================================
--- stand/lua/config.lua
+++ 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'"
@@ -497,6 +498,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
@@ -520,6 +523,24 @@
config.readConf(name, loaded_files)
end
end
+
+ if load_conf_dirs then
+ local loader_conf_dirs = getEnv("loader_conf_dirs")
+ for name in loader_conf_dirs:gmatch("[%w%p]+") do
+ if lfs.attributes(name, "mode") ~= "directory" then
+ print(MSG_FAILDIR:format(name))
+ goto continue
+ end
+
+ for file in lfs.dir(name) do
+ local fpath = name .. "/" .. file
+ if lfs.attributes(fpath, "mode") == "file" then
+ config.readConf(fpath, loaded_files)
+ end
+ end
+ ::continue::
+ end
+ end
end
-- other_kernel is optionally the name of a kernel to load, if not the default

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 16, 4:37 AM (13 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40883016
Default Alt Text
D25608.id74270.diff (2 KB)

Event Timeline