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")
443 local text = readFile(nextboot_file, true)
462 local nfile = io.open(nextboot_file, 'w')
493 local text = readFile(name, silent)
503 local n = 1
504 local status = true
509 local pattern = '^%s*' .. val.str .. '%s*(.*)';
510 local cgroups = val.groups or 2
511 local k, v, c = checkPattern(line, pattern)
548 local load_conf_dirs = next(loaded_files) == nil
566 local loader_conf_files = getEnv("loader_conf_files")
574 local loader_conf_dirs = getEnv("loader_conf_dirs")
583 local fpath = name .. "/" .. cfile
598 local flags = loader.getenv("kernel_options") or ""
599 local kernel = other_kernel or loader.getenv("kernel")
601 local function tryLoad(names)
603 local r = loader.perform("load " .. name ..
612 local function getModulePath()
613 local module_path = loader.getenv("module_path")
614 local kernel_path = loader.getenv("kernel_path")
627 local function loadBootfile()
628 local bootfile = loader.getenv("bootfile")
642 local res = loadBootfile()
655 local module_path = getModulePath()
656 local res
663 local paths = {"/boot/" .. kernel, kernel}
707 local verbose = loader.getenv("verbose_loading") or "no"
723 local xen_kernel = loader.getenv('xen_kernel')
724 local kernel = config.kernel_selected or config.kernel_loaded
725 local status
772 local mod = modules[modname]
781 local blacklist = getBlacklist()