stand: Print a warning of the loader is too old

If the loader is < 3.0, print a warning that it's too old and needs to
be upgraded.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D45889
This commit is contained in:
Warner Losh 2024-07-29 16:57:30 -06:00
parent 9f7f905075
commit a2fd7ae879
2 changed files with 25 additions and 0 deletions

View file

@ -542,6 +542,27 @@ function core.nextConsoleChoice()
end
end
-- Sanity check the boot loader revision
-- Loaders with version 3.0 have everything that we need without backwards
-- compatible hacks. Warn users that still have old versions to upgrade so
-- that we can remove the backwards compatible hacks in the future since
-- they have been there a long time.
local loader_major = 3
function core.loaderTooOld()
return loader.version == nil or loader.version < loader_major * 1000
end
if core.loaderTooOld() then
print("**********************************************************************")
print("**********************************************************************")
print("***** *****")
print("***** BOOT LOADER IS TOO OLD. PLEASE UPGRADE. *****")
print("***** *****")
print("**********************************************************************")
print("**********************************************************************")
end
recordDefaults()
hook.register("config.reloaded", core.clearCachedKernels)
return core

View file

@ -218,6 +218,10 @@ If there are no elements, this returns nil and nil.
If there is one element, this returns the front element and an empty table.
This will not operate on truly associative tables; numeric indices are
required.
.It Fn core.loaderTooOld
Returns true if the loader is too old.
Specifically, this means, is the loader old enough to require one or more
workarounds in the current lua base modules.
.El
.Sh SEE ALSO
.Xr loader.conf 5 ,