From 24a085a5424140213f15edf8be86fa61ee768afd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 19 Jan 2018 07:15:38 +0100 Subject: [PATCH] gluon-site: add default domain and check for it This does not do anything yet, as this_domain() is not implemented yet. Based-on-patch-by: lemoer --- package/gluon-core/check_site.lua | 15 +++++++++++++++ scripts/check_site.lua | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua index 99d15e43..2ae05427 100644 --- a/package/gluon-core/check_site.lua +++ b/package/gluon-core/check_site.lua @@ -1,5 +1,20 @@ need_string(in_site({'site_code'})) need_string(in_site({'site_name'})) + +-- this_domain() returns nil when multidomain support is disabled +if this_domain() then + function need_domain_name(path) + need_string(path) + need(path, function(default_domain) + local f = io.open(os.getenv('IPKG_INSTROOT') .. '/lib/gluon/domains/' .. default_domain .. '.json') + if not f then return false end + f:close() + return true + end, nil, 'be a valid domain name') + end + need_domain_name(in_site({'default_domain'})) +end + need_string_match(in_domain({'domain_seed'}), '^' .. ('%x'):rep(64) .. '$') need_string({'opkg', 'lede'}, false) diff --git a/scripts/check_site.lua b/scripts/check_site.lua index 3f3ed546..4cf6f078 100644 --- a/scripts/check_site.lua +++ b/scripts/check_site.lua @@ -18,6 +18,10 @@ function in_domain(var) return var end +function this_domain() + return nil +end + local function path_to_string(path) return table.concat(path, '/')