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
This commit is contained in:
parent
c343eedc6d
commit
c475e61f66
21
UPDATING
21
UPDATING
|
@ -27,6 +27,27 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW:
|
||||||
world, or to merely disable the most expensive debugging functionality
|
world, or to merely disable the most expensive debugging functionality
|
||||||
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||||
|
|
||||||
|
20240202:
|
||||||
|
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 following sequencing is applied:
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
20240201:
|
20240201:
|
||||||
sendmail 8.18.1 has been imported and merged. This version enforces
|
sendmail 8.18.1 has been imported and merged. This version enforces
|
||||||
stricter RFC compliance by default, especially with respect to line
|
stricter RFC compliance by default, especially with respect to line
|
||||||
|
|
|
@ -13,8 +13,9 @@ exec="echo Loading /boot/defaults/loader.conf"
|
||||||
kernel="kernel" # /boot sub-directory containing kernel and modules
|
kernel="kernel" # /boot sub-directory containing kernel and modules
|
||||||
bootfile="kernel" # Kernel name (possibly absolute path)
|
bootfile="kernel" # Kernel name (possibly absolute path)
|
||||||
kernel_options="" # Flags to be passed to the kernel
|
kernel_options="" # Flags to be passed to the kernel
|
||||||
loader_conf_files="/boot/device.hints /boot/loader.conf /boot/loader.conf.local"
|
loader_conf_files="/boot/device.hints /boot/loader.conf"
|
||||||
loader_conf_dirs="/boot/loader.conf.d"
|
loader_conf_dirs="/boot/loader.conf.d"
|
||||||
|
local_loader_conf_files="/boot/loader.conf.local"
|
||||||
nextboot_conf="/boot/nextboot.conf"
|
nextboot_conf="/boot/nextboot.conf"
|
||||||
verbose_loading="NO" # Set to YES for verbose loader output
|
verbose_loading="NO" # Set to YES for verbose loader output
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,10 @@ Space separated list of directories to process for configuration files.
|
||||||
The lua-based loader will process files with a
|
The lua-based loader will process files with a
|
||||||
.Dq .conf
|
.Dq .conf
|
||||||
suffix that are placed in these directories.
|
suffix that are placed in these directories.
|
||||||
|
Files found here are processed after the ones listed in
|
||||||
|
.Va loader_conf_files
|
||||||
|
but before the ones found in
|
||||||
|
.Va local_loader_conf_files .
|
||||||
.It Ar loader_conf_files
|
.It Ar loader_conf_files
|
||||||
Defines additional configuration files to be processed right after the
|
Defines additional configuration files to be processed right after the
|
||||||
present file.
|
present file.
|
||||||
|
@ -138,6 +142,13 @@ present file.
|
||||||
should be treated as write-only.
|
should be treated as write-only.
|
||||||
One cannot depend on any value remaining in the loader environment or carried
|
One cannot depend on any value remaining in the loader environment or carried
|
||||||
over into the kernel environment.
|
over into the kernel environment.
|
||||||
|
.It Ar local_loader_conf_files
|
||||||
|
Space separated list of additional configuration files to be processed at last,
|
||||||
|
i.e., after
|
||||||
|
.Va loader_conf_files
|
||||||
|
and
|
||||||
|
.Va loader_conf_dirs
|
||||||
|
are processed.
|
||||||
.It Ar product_vars
|
.It Ar product_vars
|
||||||
When set, must be a space separated list of environment variable names to walk
|
When set, must be a space separated list of environment variable names to walk
|
||||||
through to guess product information.
|
through to guess product information.
|
||||||
|
@ -274,6 +285,14 @@ default settings can be ignored.
|
||||||
The few of them which are important
|
The few of them which are important
|
||||||
or useful are:
|
or useful are:
|
||||||
.Bl -tag -width bootfile -offset indent
|
.Bl -tag -width bootfile -offset indent
|
||||||
|
.It Va local_loader_conf_files
|
||||||
|
.Pq Dq /boot/loader.conf.local
|
||||||
|
Ensure
|
||||||
|
.Va loader.conf.local
|
||||||
|
can always be used to override settings from files found in
|
||||||
|
.Va loader_conf_files
|
||||||
|
and
|
||||||
|
.Va loader_conf_dirs .
|
||||||
.It Va bitmap_load
|
.It Va bitmap_load
|
||||||
.Pq Dq NO
|
.Pq Dq NO
|
||||||
If set to
|
If set to
|
||||||
|
@ -455,13 +474,18 @@ It is not available in the default Forth-based loader.
|
||||||
.Sh FILES
|
.Sh FILES
|
||||||
.Bl -tag -width /boot/defaults/loader.conf -compact
|
.Bl -tag -width /boot/defaults/loader.conf -compact
|
||||||
.It Pa /boot/defaults/loader.conf
|
.It Pa /boot/defaults/loader.conf
|
||||||
default settings \(em do not change this file.
|
Default settings \(em do not change this file.
|
||||||
.It Pa /boot/loader.conf
|
.It Pa /boot/loader.conf
|
||||||
user defined settings.
|
User defined settings.
|
||||||
.It Pa /boot/loader.conf.lua
|
.It Pa /boot/loader.conf.lua
|
||||||
user defined settings written in lua.
|
User defined settings written in lua.
|
||||||
|
.It Pa /boot/loader.conf.d/*.conf
|
||||||
|
User defined settings split in separate files.
|
||||||
|
.It Pa /boot/loader.conf.d/*.lua
|
||||||
|
User defined settings written in lua and split in separate files.
|
||||||
.It Pa /boot/loader.conf.local
|
.It Pa /boot/loader.conf.local
|
||||||
machine-specific settings for sites with a common loader.conf.
|
Machine-specific settings for sites with a common loader.conf. Allow to override
|
||||||
|
settings defined in other files.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr kenv 1 ,
|
.Xr kenv 1 ,
|
||||||
|
|
|
@ -630,8 +630,7 @@ function config.readConf(file, loaded_files)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- We'll process loader_conf_dirs at the top-level readConf
|
local top_level = next(loaded_files) == nil -- Are we the top-level readConf?
|
||||||
local load_conf_dirs = next(loaded_files) == nil
|
|
||||||
print("Loading " .. file)
|
print("Loading " .. file)
|
||||||
|
|
||||||
-- The final value of loader_conf_files is not important, so just
|
-- The final value of loader_conf_files is not important, so just
|
||||||
|
@ -656,7 +655,7 @@ function config.readConf(file, loaded_files)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if load_conf_dirs then
|
if top_level then
|
||||||
local loader_conf_dirs = getEnv("loader_conf_dirs")
|
local loader_conf_dirs = getEnv("loader_conf_dirs")
|
||||||
|
|
||||||
-- If product_vars is set, it must be a list of environment variable names
|
-- If product_vars is set, it must be a list of environment variable names
|
||||||
|
@ -682,6 +681,7 @@ function config.readConf(file, loaded_files)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Process "loader_conf_dirs" extra-directories
|
||||||
if loader_conf_dirs ~= nil then
|
if loader_conf_dirs ~= nil then
|
||||||
for name in loader_conf_dirs:gmatch("[%w%p]+") do
|
for name in loader_conf_dirs:gmatch("[%w%p]+") do
|
||||||
if lfs.attributes(name, "mode") ~= "directory" then
|
if lfs.attributes(name, "mode") ~= "directory" then
|
||||||
|
@ -700,6 +700,15 @@ function config.readConf(file, loaded_files)
|
||||||
::nextdir::
|
::nextdir::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Always allow overriding with local config files, e.g.,
|
||||||
|
-- /boot/loader.conf.local.
|
||||||
|
local local_loader_conf_files = getEnv("local_loader_conf_files")
|
||||||
|
if local_loader_conf_files then
|
||||||
|
for name in local_loader_conf_files:gmatch("[%w%p]+") do
|
||||||
|
config.readConf(name, loaded_files)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,13 @@ as a configuration file
|
||||||
.Po e.g., as
|
.Po e.g., as
|
||||||
.Pa loader.conf
|
.Pa loader.conf
|
||||||
.Pc
|
.Pc
|
||||||
and then processing files listed in
|
and then process files listed in the
|
||||||
.Ev loader_conf_files
|
.Ev loader_conf_files
|
||||||
variable
|
variable. Additionnaly, the top-level call to readConf will process files listed in the
|
||||||
|
.Ev loader_conf_dirs
|
||||||
|
and
|
||||||
|
.Ev local_loader_conf_files
|
||||||
|
variables
|
||||||
.Po see
|
.Po see
|
||||||
.Xr loader.conf 5
|
.Xr loader.conf 5
|
||||||
.Pc .
|
.Pc .
|
||||||
|
|
Loading…
Reference in New Issue