Skip to content
Snippets Groups Projects
Select Git revision
  • af464144d1214dbf2a216eaf3b6216c56f06dee6
  • experimental default protected
  • v2023.2.5-ffs
  • nrb/ex400-remove-wps
  • nrb/airmax-test
  • v2023.2.4-ffs
  • nrb/ar9344-reset-sequence
  • autinerd/experimental-openwrt-24.10
  • v2023.2.3-ffs
  • v2023.2.2-ffs
  • v2023.2-ffs
  • v2023.1-ffs
  • v2022.1.4-ffs
  • feature/addMikrotikwAP
  • v2022.1.3-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • master protected
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • experimental-2025-07-04
  • experimental-2025-07-04-base
  • experimental-2025-07-01
  • experimental-2025-07-01-base
  • experimental-2025-06-25
  • experimental-2025-06-25-base
  • experimental-2025-06-24
  • experimental-2025-06-24-base
  • experimental-2025-06-22
  • experimental-2025-06-22-base
  • v2023.2.5-ffs0.1
  • experimental-2025-06-08
  • experimental-2025-06-08-base
  • experimental-2025-06-06
  • experimental-2025-06-06-base
  • experimental-2025-05-27
  • experimental-2025-05-27-base
  • experimental-2025-05-18
  • experimental-2025-05-18-base
  • experimental-2025-05-15
41 results

image_customization_lib.lua

Blame
  • image_customization_lib.lua 2.22 KiB
    local M = {
    	customization_file = nil,
    }
    
    local function evaluate_device(env, dev)
    	local selections = {
    		features = {},
    		packages = {},
    	}
    	local funcs = {}
    	local device_overrides = {}
    
    	local function add_elements(element_type, element_list)
    		-- We depend on the fact both feature and package
    		-- are already initialized as empty tables
    		for _, element in ipairs(element_list) do
    			table.insert(selections[element_type], element)
    		end
    	end
    
    	local function add_override(ovr_key, ovr_value)
    		device_overrides[ovr_key] = ovr_value
    	end
    
    	function funcs.features(features)
    		add_elements('features', features)
    	end
    
    	function funcs.packages(packages)
    		add_elements('packages', packages)
    	end
    
    	function funcs.broken(broken)
    		assert(
    			type(broken) == 'boolean',
    			'Incorrect use of broken(): has to be a boolean value')
    		add_override('broken', broken)
    	end
    
    	function funcs.disable()
    		add_override('disabled', true)
    	end
    
    	function funcs.disable_factory()
    		add_override('disable_factory', true)
    	end
    
    	function funcs.device(device_names)
    		assert(
    			type(device_names) == 'table',
    			'Incorrect use of device(): pass a list of device names as argument')
    
    		for _, device_name in ipairs(device_names) do
    			if device_name == dev.image then
    				return true
    			end
    		end
    
    		return false
    	end
    
    	function funcs.target(target, subtarget)
    		assert(
    			type(target) == 'string',
    			'Incorrect use of target(): pass a target name as first argument')
    
    		if target ~= env.BOARD then
    			return false
    		end