2020-05-26 20:40:12 +00:00
|
|
|
local errors = false
|
2019-06-14 17:20:15 +00:00
|
|
|
|
2020-05-26 20:40:12 +00:00
|
|
|
local function fail(msg)
|
|
|
|
if not errors then
|
|
|
|
errors = true
|
2019-06-14 17:20:15 +00:00
|
|
|
io.stderr:write('Configuration failed:', '\n')
|
|
|
|
end
|
|
|
|
|
2020-05-26 20:40:12 +00:00
|
|
|
io.stderr:write(' * ', msg, '\n')
|
2019-06-14 17:20:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local function match_config(f)
|
|
|
|
for line in io.lines('openwrt/.config') do
|
|
|
|
if f(line) then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2020-05-26 20:40:12 +00:00
|
|
|
local function check_config(config)
|
|
|
|
return match_config(function(line) return line == config end)
|
2019-06-14 17:20:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2020-05-26 21:30:05 +00:00
|
|
|
local lib = dofile('scripts/target_config_lib.lua')
|
2019-06-14 17:20:15 +00:00
|
|
|
|
2020-05-26 20:40:12 +00:00
|
|
|
for _, config in pairs(lib.configs) do
|
|
|
|
if config.required then
|
|
|
|
if not check_config(config:format()) then
|
|
|
|
fail(config.required)
|
2019-06-17 23:33:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-06-14 17:20:15 +00:00
|
|
|
|
2020-05-26 20:40:12 +00:00
|
|
|
if errors then
|
2020-05-10 22:04:40 +00:00
|
|
|
os.exit(1)
|
|
|
|
end
|