--[[
Do not edit this file. It is the root configuration.
Create new file in conf.d instead.
]]

-- Prepare variables specifying localization of system.
l10n = {} -- table with selected localizations
if uci then
	l10n = uci.cursor():get("updater", "l10n", "langs")
	if type(l10n) == "string" then
		l10n = {l10n}
	end
end
Export('l10n')

-- This is helper function for including localization packages.
function for_l10n(fragment)
	for _, lang in pairs(l10n or {}) do
		Install(fragment .. lang, {ignore = {"missing"}})
	end
end
Export('for_l10n')

-- Load all lua scripts from /etc/updater/conf.d
local conf_dir = root_dir .. '/etc/updater/conf.d'
local confd_type, _ = stat(conf_dir)
if confd_type == 'd' then
	for name, tp in pairs(ls(conf_dir)) do
		if tp == 'r' and name:match('.*.lua$') then
			Script("conf.d-" .. name:sub(1, name:find('.lua$') - 1), 'file://' .. conf_dir .. '/' .. name, { security = "Local" })
		end
	end
else
	DIE('No ' .. conf_dir .. ' directory!')
end
