Skip to content
Snippets Groups Projects
Select Git revision
  • 09a09d634a6608fbbff3a9295af278b99be77144
  • v2018.2.x default protected
  • 0x4A6F-rpi4
  • 0x4A6F-master
  • master
  • v2018.2.2-ffs
  • v2016.2.4-batmanbug
  • radv-filterd
  • v2016.2.x
  • hoodselector
  • v2016.1.x
  • babel
  • v2015.1.x
  • 2014.4.x
  • 2014.3.x
  • v2018.2.2-ffs0.1
  • v2018.2.1-ffs0.1
  • v2018.2.1
  • v2018.2-ffs0.1
  • v2018.2
  • v2018.1.4
  • v2018.1.3
  • v2018.1.2
  • v2018.1.1
  • v2018.1
  • v2017.1.8
  • v2017.1.7
  • v2017.1.6
  • v2017.1.5
  • v2017.1.4
  • v2017.1.3
  • v2017.1.2
  • v2016.2.7
  • v2017.1.1
  • v2017.1
35 results

target_config_check.lua

Blame
  • Forked from firmware / FFS Gluon
    Source project has a limited visibility.
    target_config_check.lua 1.23 KiB
    local ret = 0
    
    
    local function fail(...)
    	if ret == 0 then
    		ret = 1
    		io.stderr:write('Configuration failed:', '\n')
    	end
    
    	io.stderr:write(' * ', string.format(...), '\n')
    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
    
    local function check_config(pattern)
    	return match_config(function(line) return line == pattern end)
    end
    
    local function check_config_prefix(pattern)
    	return match_config(function(line) return string.sub(line, 1, -2) == pattern end)
    end
    
    
    local funcs = {}
    
    function funcs.config_message(_, message, ...)
    	local pattern = string.format(...)
    
    	if not check_config(pattern) then
    		fail('%s', message)
    	end
    end
    
    function funcs.config_package(_, pkg, value)
    	local pattern = string.format('CONFIG_PACKAGE_%s=%s', pkg, value)
    	local res
    	if value == 'y' then
    		res = check_config(pattern)
    	else
    		res = check_config_prefix(string.sub(pattern, 1, -2))
    	end
    
    	if not res then
    		fail("unable to enable package '%s'", pkg)
    	end
    end
    
    local lib = dofile('scripts/target_config_lib.lua')(funcs)
    
    for config, v in pairs(lib.configs) do
    	if v == 2 then
    		if not check_config(config) then
    			fail("unable to set '%s'", config)
    		end
    	end
    end
    
    os.exit(ret)