Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
CONFIG.LUA(8)		    System Manager's Manual		 CONFIG.LUA(8)

NAME
       config.lua -- bootloader	configuration module

DESCRIPTION
       config.lua contains configuration and module loading functionality.

       Before  hooking into or using the functionality provided	by config.lua,
       it must be included with	a statement such as the	following:

	     local config = require("config")

   Exported functions
       The following functions are exported from config.lua:

	     config.getCarouselIndex(id)       Returns	the  currently	chosen
					       index  in the carousel menu en-
					       try described by	id.   See  the
					       definition of menu.lua(8) for a
					       more  in-depth  explanation  of
					       carousels.

	     config.setCarouselIndex(id, idx)  Set the chosen  index  for  the
					       carousel	 menu  entry described
					       by id to	idx.  A	lookup will be
					       done  as	 needed	 to  determine
					       what  value idx actually	corre-
					       sponds to.

	     config.readConf(file, loaded_files)
					       Process file as a configuration
					       file (e.g., as loader.conf) and
					       then process  files  listed  in
					       the loader_conf_files variable.
					       Additionnaly,   the   top-level
					       call to readConf	 will  process
					       files	 listed	    in	   the
					       loader_conf_dirs		   and
					       local_loader_conf_files	 vari-
					       ables   (see   loader.conf(5)).
					       The  caller may optionally pass
					       in a table as the  loaded_files
					       argument,  which	uses filenames
					       as keys and any	non-nil	 value
					       to indicate that	the file named
					       by  the	key  has  already been
					       loaded and should not be	loaded
					       again.

	     config.processFile(name, silent)  Process and  parse  name	 as  a
					       configuration   file.   Returns
					       true if name exists and	parses
					       without error, false otherwise.
					       If      silent	  is	 true,
					       config.processFile()  will  not
					       consider	 a failure to read the
					       file as a failure.

	     config.parse(text)		       Parse text as  a	 configuration
					       file.   This is used internally
					       by   config.processFile()    to
					       parse the contents of a config-
					       uration	file.  Returns true if
					       parsing succeeds	without	error,
					       false if	an error occurred.   A
					       message	is also	printed	to the
					       console if an error is  encoun-
					       tered.

	     config.loadKernel(other_kernel)   Attempts	 to  load other_kernel
					       as a kernel.   If  other_kernel
					       is   unset  config.loadKernel()
					       will attempt to load  "kernel".
					       Otherwise,  it will try to load
					       "kernel"	      first	  from
					       /boot/{other_kernel}, then from
					       {other_kernel}.

					       The  latter is tried in case an
					       absolute	path has  been	speci-
					       fied  to	 the  kernel  to  use.
					       module_path is amended  to  in-
					       clude  the directory the	kernel
					       was found in if either of these
					       paths result in a  loaded  ker-
					       nel.

					       If  no  kernel  was loaded from
					       either	 of    these	paths,
					       config.loadKernel()   will  at-
					       tempt to	load  a	 kernel	 named
					       "{other_kernel}"		  from
					       module_path instead of attempt-
					       ing  to	load  a	 kernel	 named
					       "kernel".

					       Returns	true  if  a kernel was
					       loaded, false if	no kernel  was
					       loaded.

	     config.selectKernel(kernel)       Set  kernel  to the kernel that
					       will  be	 loaded	 when	either
					       autoboot	 or  boot are invoked.
					       This is usually called  by  the
					       menu  system  as	the kernel se-
					       lector  carousel	  is   toggled
					       through.

	     config.load(file, reload)	       Loads  file  as a configuration
					       file.  If file  is  not	speci-
					       fied,
					       /boot/defaults/loader.conf   is
					       used.  config.load() will  then
					       silently	attempt	to process any
					       files	    specified	    in
					       loader_conf_files  after	  file
					       has	 been	    processed.
					       nextboot(8) configuration  will
					       also  be	 checked  as  part  of
					       config.load().  Before  return-
					       ing,  all "config.loaded" hooks
					       will be run if  reload  is  not
					       set to true.

	     config.reload(file)	       Reloads file as a configuration
					       file.  config.reload() will re-
					       store the environment to	how it
					       existed	before the last	config
					       was loaded, then	it will	invoke
					       config.load(file).  Before  re-
					       turning,	 all "config.reloaded"
					       hooks will be run.

	     config.loadelf()		       Loads all ELF objects, the  se-
					       lected  kernel  as  well	as any
					       modules configured to  be  pre-
					       loaded in loader.conf(5).  This
					       will  be	 called	by the Lua in-
					       tercepted  autoboot  and	  boot
					       commands.

	     config.enableModule(modname)      Marks a module named modname to
					       be	  loaded	during
					       config.loadelf().  If the  mod-
					       ule was previously blacklisted,
					       then  it	will be	forcefully al-
					       lowed to	load.

	     config.disableModule(modname)     Marks a module named modname to
					       not    be     loaded	during
					       config.loadelf().

	     config.isModuleEnabled(modname)   Checks	if  the	 module	 named
					       modname will be	loaded	during
					       config.loadelf().    It	checks
					       both that the module is	marked
					       for  loading and	that it	is ei-
					       ther forced or not blacklisted.

	     config.getModuleInfo()	       Returns a table with  "modules"
					       and "blacklist" tables describ-
					       ing the modules that the	config
					       module  has  been made aware of
					       via loader.conf(5) as well as a
					       representation		    of
					       module_blacklist.

   Defined Hooks
       The following hooks are defined in config.lua:

	     config.buildenv(env)

	     config.loaded()

	     config.reloaded()

	     kernel.loaded()

	     modules.loaded()

       Note  that  the config.buildenv() hook is only invoked when an environ-
       ment needs to be	built to execute a lua	configuration  file  that  has
       been  specified in loader_conf_files.  It will be invoked for each con-
       figuration file encountered.

SEE ALSO
       loader.conf(5), loader(8), menu.lua(8), nextboot(8)

AUTHORS
       The  config.lua	file   was   originally	  written   by	 Pedro	 Souza
       <pedrosouza@FreeBSD.org>.  Later	work and this manual page was done by
       Kyle Evans <kevans@FreeBSD.org>.

FreeBSD	14.3			March 29, 2025			 CONFIG.LUA(8)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=config.lua&sektion=8&manpath=FreeBSD+14.3-RELEASE+and+Ports>

home | help