check_site: move site loading logic to check_site_lib (which is renamed to check_site.lua)
This commit is contained in:
parent
43628c1679
commit
775028475b
@ -11,13 +11,8 @@ shell-verbatim = $(call shell-unescape,$(call shell-escape,$(1)))
|
||||
|
||||
|
||||
define GluonCheckSite
|
||||
[ -z "$$IPKG_INSTROOT" ] || "${TOPDIR}/staging_dir/hostpkg/bin/lua" -e 'dofile()' <<'END__GLUON__CHECK__SITE'
|
||||
local f = assert(io.open(os.getenv('IPKG_INSTROOT') .. '/lib/gluon/site.json'))
|
||||
local site_json = f:read('*a')
|
||||
f:close()
|
||||
|
||||
site = require('cjson').decode(site_json)
|
||||
$(call shell-verbatim,cat '$(TOPDIR)/../scripts/check_site_lib.lua' '$(1)')
|
||||
[ -z "$$IPKG_INSTROOT" ] || "${TOPDIR}/staging_dir/hostpkg/bin/lua" "${TOPDIR}/../scripts/check_site.lua" <<'END__GLUON__CHECK__SITE'
|
||||
$(call shell-verbatim,cat '$(1)')
|
||||
END__GLUON__CHECK__SITE
|
||||
endef
|
||||
|
||||
|
@ -1,3 +1,15 @@
|
||||
local cjson = require 'cjson'
|
||||
|
||||
local function load_json(filename)
|
||||
local f = assert(io.open(filename))
|
||||
local json = cjson.decode(f:read('*a'))
|
||||
f:close()
|
||||
return json
|
||||
end
|
||||
|
||||
local site = load_json(os.getenv('IPKG_INSTROOT') .. '/lib/gluon/site.json')
|
||||
|
||||
|
||||
function in_site(var)
|
||||
return var
|
||||
end
|
||||
@ -170,3 +182,6 @@ end
|
||||
function need_array_of(path, array, required)
|
||||
return need_array(path, function(e) need_one_of(e, array) end, required)
|
||||
end
|
||||
|
||||
|
||||
dofile()
|
Loading…
Reference in New Issue
Block a user