Date: Wed, 6 Jun 2018 18:28:17 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334723 - head/stand/lua Message-ID: <201806061828.w56ISH8Y059574@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Wed Jun 6 18:28:17 2018 New Revision: 334723 URL: https://svnweb.freebsd.org/changeset/base/334723 Log: lualoader: Add a loaded hook for others to execute upon config load This will not be executed on reload, though later work could allow for that. It's intended/expected that later work won't generally need to happen on every config load, just once (for, e.g., menu initialization) or just when config is reloaded but not upon the initial load. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Jun 6 16:47:33 2018 (r334722) +++ head/stand/lua/config.lua Wed Jun 6 18:28:17 2018 (r334723) @@ -458,7 +458,7 @@ function config.selectKernel(kernel) config.kernel_selected = kernel end -function config.load(file) +function config.load(file, reloading) if not file then file = "/boot/defaults/loader.conf" end @@ -485,13 +485,16 @@ function config.load(file) config.module_path = loader.getenv("module_path") local verbose = loader.getenv("verbose_loading") or "no" config.verbose = verbose:lower() == "yes" + if not reloading then + hook.runAll("config.loaded") + end end -- Reload configuration function config.reload(file) modules = {} restoreEnv() - config.load(file) + config.load(file, true) hook.runAll("config.reloaded") end @@ -512,5 +515,6 @@ function config.loadelf() end end +hook.registerType("config.loaded") hook.registerType("config.reloaded") return config
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806061828.w56ISH8Y059574>