Lines Matching full:local

30 local hook = require("hook")
32 local config = {}
33 local modules = {}
34 local carousel_choices = {}
36 local env_changed = {}
38 local env_restore = {}
40 local MSG_FAILDIR = "Failed to load conf dir '%s': not a directory"
41 local MSG_FAILEXEC = "Failed to exec '%s'"
42 local MSG_FAILSETENV = "Failed to '%s' with value: %s"
43 local MSG_FAILOPENCFG = "Failed to open config: '%s'"
44 local MSG_FAILREADCFG = "Failed to read config: '%s'"
45 local MSG_FAILPARSECFG = "Failed to parse config: '%s'"
46 local MSG_FAILEXECLUA = "Failed to execute lua conf '%s': '%s'"
47 local MSG_FAILPARSEVAR = "Failed to parse variable '%s': %s"
48 local MSG_FAILEXBEF = "Failed to execute '%s' before loading '%s'"
49 local MSG_FAILEXAF = "Failed to execute '%s' after loading '%s'"
50 local MSG_MALFORMED = "Malformed line (%d):\n\t'%s'"
51 local MSG_DEFAULTKERNFAIL = "No kernel set, failed to load from module_path"
52 local MSG_KERNFAIL = "Failed to load kernel '%s'"
53 local MSG_XENKERNFAIL = "Failed to load Xen kernel '%s'"
54 local MSG_XENKERNLOADING = "Loading Xen kernel..."
55 local MSG_KERNLOADING = "Loading kernel..."
56 local MSG_MODLOADING = "Loading configured modules..."
57 local MSG_MODBLACKLIST = "Not loading blacklisted module '%s'"
59 local MSG_FAILSYN_QUOTE = "Stray quote at position '%d'"
60 local MSG_FAILSYN_EOLESC = "Stray escape at end of line"
61 local MSG_FAILSYN_EOLVAR = "Unescaped $ at end of line"
62 local MSG_FAILSYN_BADVAR = "Malformed variable expression at position '%d'"
67 local MODULEEXPR = '([%w%d-_.]+)'
68 local QVALEXPR = '"([^"]*)"'
69 local QVALREPL = QVALEXPR:gsub('%%', '%%%%')
70 local WORDEXPR = "([-%w%d][-%w%d_.]*)"
71 local WORDREPL = WORDEXPR:gsub('%%', '%%%%')
76 local loader_env_restricted_table = {
84 local function restoreEnv()
87 local restore_value = env_restore[k]
92 local current_value = loader.getenv(k)
115 local function getEnv(key)
124 local function setEnv(key, value)
142 local function setKey(key, name, value)
152 local function escapeName(name)
156 local function processEnvVar(value)
157 local pval, vlen = '', #value
158 local nextpos, vdelim, vinit = 1
159 local vpat
165 local c = value:sub(i, i)
190 local name = value:match(vpat, vinit)
199 local repl = loader.getenv(name) or ""
212 local function checkPattern(line, pattern)
213 local function _realCheck(_line, _pattern)
218 local k, v, c
247 local pattern_table = {
337 local pv, msg = processEnvVar(v)
351 local function isValidComment(line)
353 local s = line:match("^%s*#.*")
364 local function getBlacklist()
365 local blacklist = {}
366 local blacklist_str = loader.getenv('module_blacklist')
377 local function loadModule(mod, silent)
378 local status = true
379 local blacklist = getBlacklist()
380 local pstatus
383 local module_name = v.name or k
393 local str = "load "
440 local function readFile(name, silent)
441 local f = io.open(name)
449 local text, _ = io.read(f)
459 local function checkNextboot()
460 local nextboot_file = loader.getenv("nextboot_conf")
461 local nextboot_enable = loader.getenv("nextboot_enable")
472 local text = readFile(nextboot_file, true)
492 local nfile = io.open(nextboot_file, 'w')
504 local function processEnv(k, v)
507 local matched = k:match(val.name)
536 local text = readFile(name, silent)
542 local cfg_env = setmetatable({}, {
557 -- Give local modules a chance to populate the config
560 local res, err = pcall(load(text, name, "t", cfg_env))
563 local t = type(v)
568 local pval = processEnv(k, v)
586 local n = 1
587 local status = true
595 local pattern = '^%s*' .. val.str .. '%s*(.*)';
596 local cgroups = val.groups or 2
597 local k, v, c = checkPattern(line, pattern)
633 local top_level = next(loaded_files) == nil -- Are we the top-level readConf?
651 local loader_conf_files = getEnv("loader_conf_files")
659 local loader_conf_dirs = getEnv("loader_conf_dirs")
667 local product_vars = getEnv("product_vars")
669 local product_conf_dirs = ""
671 local product = getEnv(var)
694 local fpath = name .. "/" .. cfile
704 -- Always allow overriding with local config files, e.g.,
705 -- /boot/loader.conf.local.
706 local local_loader_conf_files = getEnv("local_loader_conf_files")
718 local flags = loader.getenv("kernel_options") or ""
719 local kernel = other_kernel or loader.getenv("kernel")
721 local function tryLoad(names)
723 local r = loader.perform("load " .. name ..
732 local function getModulePath()
733 local module_path = loader.getenv("module_path")
734 local kernel_path = loader.getenv("kernel_path")
747 local function loadBootfile()
748 local bootfile = loader.getenv("bootfile")
762 local res = loadBootfile()
775 local module_path = getModulePath()
776 local res
783 local paths = {"/boot/" .. kernel, kernel}
827 local verbose = loader.getenv("verbose_loading") or "no"
843 local xen_kernel = loader.getenv('xen_kernel')
844 local kernel = config.kernel_selected or config.kernel_loaded
845 local status
892 local mod = modules[modname]
901 local blacklist = getBlacklist()