Skip to content
Snippets Groups Projects
Select Git revision
  • experimental
  • v3.3 default protected
  • nrb/airmax-test
  • nrb/ro-flash-nanostation-airmax
  • nrb/add-node-whisperer
  • v3.2 protected
  • v3.1 protected
  • nrb-domains
  • v3.0 protected
  • nrb/dns-cache
  • v2.9 protected
  • feature/addMikrotikwAP
  • v2.8 protected
  • v2.5.1 protected
  • v2.7 protected
  • v2.6 protected
  • v2.5 protected
  • v2.4 protected
  • cpe510
  • nrb/gluon-master-cpe510
  • v3.2.1+2024-12-15
  • v3.2+2024-12-04
  • v3.1+2024-07-08
  • v2.9+2023-05-13
  • v2.9+2023-05-12
  • v2.9+2023-05-10
  • v2.8+2023-03-05
  • v2.7+2022-12-03
  • v2.6+2022-09-06
  • v2.5+2022-05-07
  • v2.5+2022-05-05
  • v2.4+2022-02-26
  • v2.3+2021-06-03
  • v2.3+2021-04-30
  • v2.2+2021-04-16
  • v2.2+2020-04-16
  • v2.1+2020-12-11
  • v2.1+2020-11-17
  • v2.0+2020-09-26
  • v2.0+2020-06-28
40 results

image-customization.lua

Blame
  • target_lib.lua 6.63 KiB
    local image_customization_lib = dofile('scripts/image_customization_lib.lua')
    
    -- Functions for use in targets/*
    local F = {}
    
    -- To be accessed by scripts using target_lib
    local M = setmetatable({}, { __index = F })
    
    local funcs = setmetatable({}, {
    	__index = function(_, k)
    		return F[k] or _G[k]
    	end,
    })
    
    local env = setmetatable({}, {
    	__index = function(_, k) return os.getenv(k) end
    })
    F.env = env
    
    assert(env.GLUON_SITEDIR)
    assert(env.GLUON_TARGETSDIR)
    assert(env.GLUON_RELEASE)
    assert(env.GLUON_DEPRECATED)
    
    
    M.site_code = assert(
    	dofile('scripts/site_config.lua')('site.conf').site_code, 'site_code missing in site.conf'
    )
    M.target_packages = {}
    M.configs = {}
    M.devices = {}
    M.images = {}
    
    -- Initialize image-customization
    image_customization_lib.init(env)
    
    local default_options = {
    	factory = '-squashfs-factory',
    	factory_ext = '.bin',
    	sysupgrade = '-squashfs-sysupgrade',
    	sysupgrade_ext = '.bin',
    	extra_images = {},
    	aliases = {},
    	manifest_aliases = {},
    	packages = {},
    	class = 'standard',
    	deprecated = false,
    	broken = false,
    }
    
    
    local gluon_devices, unknown_devices = {}, {}
    for dev in string.gmatch(env.GLUON_DEVICES or '', '%S+') do
    	gluon_devices[dev] = true
    	unknown_devices[dev] = true
    end
    
    function F.istrue(v)
    	return (tonumber(v) or 0) > 0
    end
    
    local function device_broken(device_info, overrides)
    	if F.istrue(env.BROKEN) then
    		return false
    	end
    
    	if overrides['broken'] ~= nil then
    		return overrides['broken'] == true
    	elseif device_info.options.broken then
    		return true