-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add domain specific configs to gluon #1216
Changes from all commits
b730daf
0834985
387bf99
b3c9ac8
5999fdb
a73ae6c
0189f35
c5ca75d
d776bf7
4facaf6
bf34465
88a9a97
33765c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
need_string_array 'authorized_keys' | ||
need_string_array(in_site('authorized_keys')) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
need_string 'autoupdater.branch' | ||
need_string(in_site('autoupdater.branch')) | ||
|
||
local function check_branch(k, _) | ||
assert_uci_name(k) | ||
local function check_branch(k, conf_name) | ||
assert_uci_name(k, conf_name) | ||
|
||
local prefix = string.format('autoupdater.branches[%q].', k) | ||
|
||
need_string(prefix .. 'name') | ||
need_string(in_site(prefix .. 'name')) | ||
need_string_array_match(prefix .. 'mirrors', '^http://') | ||
need_number(prefix .. 'good_signatures') | ||
need_string_array_match(prefix .. 'pubkeys', '^%x+$') | ||
need_number(in_site(prefix .. 'good_signatures')) | ||
need_string_array_match(in_site(prefix .. 'pubkeys'), '^%x+$') | ||
end | ||
|
||
need_table('autoupdater.branches', check_branch) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
if need_table('config_mode', nil, false) and need_table('config_mode.owner', nil, false) then | ||
need_boolean('config_mode.owner.obligatory', false) | ||
if need_table(in_site('config_mode'), nil, false) and need_table(in_site('config_mode.owner'), nil, false) then | ||
need_boolean(in_site('config_mode.owner.obligatory'), false) | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
if need_table('config_mode', nil, false) and need_table('config_mode.geo_location', nil, false) then | ||
need_boolean('config_mode.geo_location.show_altitude', false) | ||
if need_table(in_site('config_mode'), nil, false) and need_table(in_site('config_mode.geo_location'), nil, false) then | ||
need_boolean(in_site('config_mode.geo_location.show_altitude'), false) | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config system system | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
domain_code=$(uci get gluon.system.domain_code) | ||
|
||
[ -f /lib/gluon/domains/${domain_code}.json ] || (echo "file not found: /lib/gluon/domains/${domain_code}.json" >&2; exit 1) || exit 1 | ||
|
||
for s in /lib/gluon/upgrade/*; do | ||
echo -n ${s}: | ||
(${s} && echo " ok") || echo " error" | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/lua | ||
local jsonc = require 'luci.jsonc' | ||
local site = require 'gluon.site' | ||
|
||
print(jsonc.stringify(site(), true)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$', false) | ||
need_string_array_match('extra_prefixes6', '^[%x:]+/%d+$', false) | ||
need_string_match(in_domain('prefix4'), '^%d+.%d+.%d+.%d+/%d+$', false) | ||
need_string_array_match(in_domain('extra_prefixes6'), '^[%x:]+/%d+$', false) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
need_string('roles.default', false) | ||
need_string(in_site('roles.default'), false) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
need_boolean('setup_mode.skip', false) | ||
|
||
need_boolean(in_site('setup_mode.skip'), false) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ PKG_VERSION:=$(if $(DUMP),x,$(GLUON_SITE_VERSION)) | |
|
||
|
||
PKG_CONFIG_DEPENDS := CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR | ||
PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/i18n/ | ||
PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/domains/ $(GLUON_SITEDIR)/i18n/ | ||
PKG_BUILD_DEPENDS := lua-cjson/host | ||
|
||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) | ||
|
@@ -38,19 +38,34 @@ endef | |
|
||
define Build/Prepare | ||
mkdir -p $(PKG_BUILD_DIR) | ||
mkdir -p $(PKG_BUILD_DIR)/domains | ||
endef | ||
|
||
define Build/Configure | ||
endef | ||
|
||
define Build/Compile | ||
GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/site_config.lua"))))' > $(PKG_BUILD_DIR)/site.json | ||
ls $(call qstrip,$(CONFIG_GLUON_SITEDIR))/domains/*.conf > /dev/null # at least one domain cfg has to exist | ||
GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(assert(dofile("../../scripts/site_config.lua")).default_domain_code)' > $(PKG_BUILD_DIR)/default_domain_code | ||
ls '$(call qstrip,$(CONFIG_GLUON_SITEDIR))'/domains/$$$$(cat $(PKG_BUILD_DIR)/default_domain_code).conf # ensure default_domain_code exists | ||
rm -f $(PKG_BUILD_DIR)/domains/*.json | ||
for domain_cfg in `find $(call qstrip,$(CONFIG_GLUON_SITEDIR))/domains/ -iname \*.conf -printf "%f\n"`; do \ | ||
dc=$$$${domain_cfg%.conf}; \ | ||
GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/domain_config.lua")("'$$$${dc}'"))))' > $(PKG_BUILD_DIR)/domains/$$$${dc}.json; \ | ||
aliases=$$$$(GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'for alias_name, _ in pairs(dofile("../../scripts/domain_config.lua")("'$$$${dc}'")["domain_aliases"] or {}) do print(alias_name.." ") end'); \ | ||
for alias in $$$${aliases}; do \ | ||
ln -s $$$${dc}.json $(PKG_BUILD_DIR)/domains/$$$${alias}.json; \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to use |
||
done; \ | ||
done | ||
$(call GluonBuildI18N,gluon-site,$(GLUON_SITEDIR)/i18n) | ||
endef | ||
|
||
define Package/gluon-site/install | ||
$(INSTALL_DIR) $(1)/lib/gluon | ||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/site.json $(1)/lib/gluon/ | ||
$(INSTALL_DIR) $(1)/lib/gluon/domains | ||
$(CP) $(PKG_BUILD_DIR)/domains/*.json $(1)/lib/gluon/domains/ | ||
echo '$(GLUON_SITE_VERSION)' > $(1)/lib/gluon/site-version | ||
echo '$(call qstrip,$(CONFIG_GLUON_RELEASE))' > $(1)/lib/gluon/release | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not using
/etc/config/gluon-core
which is already supplied by gluon-core?EDIT: never mind, it is already answered here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think calling the section 'core' would make sense, as this config is handled by gluon-core (and we generally store config for package
gluon-X
in sectiongluon.X
).The commit title is not accurate, the top level of the UCI structure is called "package", so this would add a package "gluon" and a section "gluon.system" (or "gluon.core") to UCI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to pick up this commit first (with my suggested changes), so the rest of Gluon can start using it. This PR will need to be adjusted to the changed section name.