Lines 460-496
Link Here
|
460 |
return status |
460 |
return status |
461 |
end |
461 |
end |
462 |
|
462 |
|
463 |
function config.readConfFiles(files, loaded_files) |
463 |
function config.readConf(file, loaded_files) |
464 |
if files ~= nil then |
464 |
if loaded_files == nil then |
465 |
-- The caller may not have passed in loader_conf_files; we could |
465 |
loaded_files = {} |
466 |
-- have instead gotten some other string of files. We don't |
466 |
end |
467 |
-- want to trigger any redundant re-read/loads based on this. |
|
|
468 |
local prefiles = loader.getenv("loader_conf_files") |
469 |
for name in files:gmatch("([%w%p]+)%s*") do |
470 |
if loaded_files[name] ~= nil then |
471 |
goto continue |
472 |
end |
473 |
|
467 |
|
474 |
print("Loading " .. name) |
468 |
if loaded_files[file] ~= nil then |
475 |
-- These may or may not exist, and that's ok. Do a |
469 |
return |
476 |
-- silent parse so that we complain on parse errors but |
470 |
end |
477 |
-- not for them simply not existing. |
|
|
478 |
if not config.processFile(name, true) then |
479 |
print(MSG_FAILPARSECFG:format(name)) |
480 |
end |
481 |
|
471 |
|
482 |
loaded_files[name] = true |
472 |
print("Loading " .. file) |
483 |
local newfiles = loader.getenv("loader_conf_files") |
473 |
|
484 |
if prefiles ~= newfiles then |
474 |
-- Make sure that we can detect if "loader_conf_files" is set by |
485 |
-- Recurse; process the new files immediately. |
475 |
-- file by ensuring that 'env_changed' for this variable is not |
486 |
-- If we come back and it turns out we've |
476 |
-- set before processing the file. We do this to be able to |
487 |
-- already loaded the rest of what was in the |
477 |
-- distinguish the case where "loader_conf_files" is overriden in |
488 |
-- original loader_conf_files, no big deal. |
478 |
-- the to-read file with the same value that it currently has (in |
489 |
config.readConfFiles(newfiles, loaded_files) |
479 |
-- which case files must be loaded) from the case where it is not |
490 |
prefiles = newfiles |
480 |
-- specified (in which case no file is to be loaded). We'll have |
491 |
end |
481 |
-- to restore the state if not overwritten (see below). |
492 |
::continue:: |
482 |
local saved_lcf_env_changed = env_changed["loader_conf_files"] |
|
|
483 |
if saved_lcf_env_changed ~= nil then |
484 |
env_changed["loader_conf_files"] = nil |
485 |
end |
486 |
|
487 |
-- These may or may not exist, and that's ok. Do a |
488 |
-- silent parse so that we complain on parse errors but |
489 |
-- not for them simply not existing. |
490 |
if not config.processFile(file, true) then |
491 |
print(MSG_FAILPARSECFG:format(file)) |
492 |
end |
493 |
|
494 |
loaded_files[file] = true |
495 |
|
496 |
-- Going to process "loader_conf_files" extra-files |
497 |
local loader_conf_files = env_changed["loader_conf_files"] |
498 |
if loader_conf_files ~= nil then |
499 |
for name in loader_conf_files:gmatch("[%w%p]+") do |
500 |
config.readConf(name, loaded_files) |
493 |
end |
501 |
end |
|
|
502 |
else |
503 |
-- Restore back the original "loader_conf_files" value in |
504 |
-- "env_changed" if it was not overriden in the meantime. |
505 |
env_changed["loader_conf_files"] = saved_lcf_env_changed |
494 |
end |
506 |
end |
495 |
end |
507 |
end |
496 |
|
508 |
|
Lines 602-614
Link Here
|
602 |
file = "/boot/defaults/loader.conf" |
614 |
file = "/boot/defaults/loader.conf" |
603 |
end |
615 |
end |
604 |
|
616 |
|
605 |
if not config.processFile(file) then |
617 |
config.readConf(file) |
606 |
print(MSG_FAILPARSECFG:format(file)) |
|
|
607 |
end |
608 |
|
618 |
|
609 |
local loaded_files = {file = true} |
|
|
610 |
config.readConfFiles(loader.getenv("loader_conf_files"), loaded_files) |
611 |
|
612 |
checkNextboot() |
619 |
checkNextboot() |
613 |
|
620 |
|
614 |
local verbose = loader.getenv("verbose_loading") or "no" |
621 |
local verbose = loader.getenv("verbose_loading") or "no" |