Lines Matching refs:local

32 local hook = require("hook")
34 local config = {}
35 local modules = {}
36 local carousel_choices = {}
38 local env_changed = {}
40 local env_restore = {}
42 local MSG_FAILDIR = "Failed to load conf dir '%s': not a directory"
43 local MSG_FAILEXEC = "Failed to exec '%s'"
44 local MSG_FAILSETENV = "Failed to '%s' with value: %s"
45 local MSG_FAILOPENCFG = "Failed to open config: '%s'"
46 local MSG_FAILREADCFG = "Failed to read config: '%s'"
47 local MSG_FAILPARSECFG = "Failed to parse config: '%s'"
48 local MSG_FAILPARSEVAR = "Failed to parse variable '%s': %s"
49 local MSG_FAILEXBEF = "Failed to execute '%s' before loading '%s'"
50 local MSG_FAILEXAF = "Failed to execute '%s' after loading '%s'"
51 local MSG_MALFORMED = "Malformed line (%d):\n\t'%s'"
52 local MSG_DEFAULTKERNFAIL = "No kernel set, failed to load from module_path"
53 local MSG_KERNFAIL = "Failed to load kernel '%s'"
54 local MSG_XENKERNFAIL = "Failed to load Xen kernel '%s'"
55 local MSG_XENKERNLOADING = "Loading Xen kernel..."
56 local MSG_KERNLOADING = "Loading kernel..."
57 local MSG_MODLOADING = "Loading configured modules..."
58 local MSG_MODBLACKLIST = "Not loading blacklisted module '%s'"
60 local MSG_FAILSYN_QUOTE = "Stray quote at position '%d'"
61 local MSG_FAILSYN_EOLESC = "Stray escape at end of line"
62 local MSG_FAILSYN_EOLVAR = "Unescaped $ at end of line"
63 local MSG_FAILSYN_BADVAR = "Malformed variable expression at position '%d'"
65 local MODULEEXPR = '([-%w_]+)'
66 local QVALEXPR = '"(.*)"'
67 local QVALREPL = QVALEXPR:gsub('%%', '%%%%')
68 local WORDEXPR = "([-%w%d][-%w%d_.]*)"
69 local WORDREPL = WORDEXPR:gsub('%%', '%%%%')
74 local loader_env_restricted_table = {
82 local function restoreEnv()
85 local restore_value = env_restore[k]
90 local current_value = loader.getenv(k)
113 local function getEnv(key)
122 local function setEnv(key, value)
140 local function setKey(key, name, value)
150 local function escapeName(name)
154 local function processEnvVar(value)
155 local pval, vlen = '', #value
156 local nextpos, vdelim, vinit = 1
157 local vpat
163 local c = value:sub(i, i)
188 local name = value:match(vpat, vinit)
197 local repl = loader.getenv(name) or ""
210 local function checkPattern(line, pattern)
211 local function _realCheck(_line, _pattern)
216 local k, v, c
245 local pattern_table = {
317 local pv, msg = processEnvVar(v)
329 local function isValidComment(line)
331 local s = line:match("^%s*#.*")
342 local function getBlacklist()
343 local blacklist = {}
344 local blacklist_str = loader.getenv('module_blacklist')
355 local function loadModule(mod, silent)
356 local status = true
357 local blacklist = getBlacklist()
358 local pstatus
361 local module_name = v.name or k
371 local str = "load "
418 local function readFile(name, silent)
419 local f = io.open(name)
427 local text, _ = io.read(f)
437 local function checkNextboot()
438 local nextboot_file = loader.getenv("nextboot_conf")
439 local nextboot_enable = loader.getenv("nextboot_enable")
450 local text = readFile(nextboot_file, true)
470 local nfile = io.open(nextboot_file, 'w')
502 local text = readFile(name, silent)
512 local n = 1
513 local status = true
518 local pattern = '^%s*' .. val.str .. '%s*(.*)';
519 local cgroups = val.groups or 2
520 local k, v, c = checkPattern(line, pattern)
557 local load_conf_dirs = next(loaded_files) == nil
575 local loader_conf_files = getEnv("loader_conf_files")
583 local loader_conf_dirs = getEnv("loader_conf_dirs")
592 local fpath = name .. "/" .. cfile
607 local flags = loader.getenv("kernel_options") or ""
608 local kernel = other_kernel or loader.getenv("kernel")
610 local function tryLoad(names)
612 local r = loader.perform("load " .. name ..
621 local function getModulePath()
622 local module_path = loader.getenv("module_path")
623 local kernel_path = loader.getenv("kernel_path")
636 local function loadBootfile()
637 local bootfile = loader.getenv("bootfile")
651 local res = loadBootfile()
664 local module_path = getModulePath()
665 local res
672 local paths = {"/boot/" .. kernel, kernel}
716 local verbose = loader.getenv("verbose_loading") or "no"
732 local xen_kernel = loader.getenv('xen_kernel')
733 local kernel = config.kernel_selected or config.kernel_loaded
734 local status
781 local mod = modules[modname]
790 local blacklist = getBlacklist()