Validate site.conf

This commit is contained in:
Matthias Schiffer 2014-07-05 02:48:56 +02:00
parent 626056e625
commit ffd86668fe
14 changed files with 111 additions and 14 deletions

View File

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-autoupdater PKG_NAME:=gluon-autoupdater
PKG_VERSION:=2 PKG_VERSION:=3
PKG_RELEASE:=$(GLUON_BRANCH) PKG_RELEASE:=$(GLUON_BRANCH)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(GLUONDIR)/include/package.mk
define Package/gluon-autoupdater define Package/gluon-autoupdater
SECTION:=gluon SECTION:=gluon
@ -34,4 +34,9 @@ define Package/gluon-autoupdater/install
fi fi
endef endef
define Package/gluon-autoupdater/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-autoupdater)) $(eval $(call BuildPackage,gluon-autoupdater))

View File

@ -0,0 +1,13 @@
need_string 'autoupdater.branch'
local function check_branch(k, _)
local prefix = string.format('autoupdater.branches[%q].', k)
need_string(prefix .. 'name')
need_string_array(prefix .. 'mirrors')
need_number(prefix .. 'probability')
need_number(prefix .. 'good_signatures')
need_string_array(prefix .. 'pubkeys')
end
need_table('autoupdater.branches', check_branch)

View File

@ -4,11 +4,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode PKG_NAME:=gluon-config-mode
PKG_VERSION:=2 PKG_VERSION:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(GLUONDIR)/include/package.mk
define Package/gluon-config-mode define Package/gluon-config-mode
SECTION:=gluon SECTION:=gluon
@ -35,4 +35,9 @@ define Package/gluon-config-mode/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
endef endef
define Package/gluon-config-mode/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-config-mode)) $(eval $(call BuildPackage,gluon-config-mode))

View File

@ -0,0 +1,3 @@
need_string 'config_mode.msg_welcome'
need_string 'config_mode.msg_pubkey'
need_string 'config_mode.msg_reboot'

View File

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-core PKG_NAME:=gluon-core
PKG_VERSION:=2 PKG_VERSION:=3
PKG_RELEASE:=$(GLUON_VERSION) PKG_RELEASE:=$(GLUON_VERSION)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(GLUONDIR)/include/package.mk
define Package/gluon-core define Package/gluon-core
SECTION:=gluon SECTION:=gluon
@ -36,4 +36,9 @@ define Package/gluon-core/install
echo "$(GLUON_VERSION)" > $(1)/lib/gluon/gluon-version echo "$(GLUON_VERSION)" > $(1)/lib/gluon/gluon-version
endef endef
define Package/gluon-core/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-core)) $(eval $(call BuildPackage,gluon-core))

View File

@ -0,0 +1,10 @@
need_string 'site_code'
need_string 'site_name'
need_string 'hostname_prefix'
need_string 'timezone'
need_string_array('ntp_servers', false)
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$')
need_string_match('prefix6', '^[%x:]+/%d+$')

View File

@ -1,11 +1,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-legacy PKG_NAME:=gluon-legacy
PKG_VERSION:=1 PKG_VERSION:=2
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(GLUONDIR)/include/package.mk
define Package/gluon-legacy define Package/gluon-legacy
SECTION:=gluon SECTION:=gluon
@ -32,4 +32,9 @@ define Package/gluon-legacy/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
endef endef
define Package/gluon-legacy/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-legacy)) $(eval $(call BuildPackage,gluon-legacy))

View File

@ -0,0 +1,8 @@
need_string_array 'legacy.version_files'
need_string_array 'legacy.old_files'
need_string_array 'legacy.config_mode_configs'
need_string_array 'legacy.fastd_configs'
need_string 'legacy.mesh_ifname'
need_string_array 'legacy.tc_configs'
need_string_array 'legacy.wifi_names'

View File

@ -1,11 +1,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-batman-adv PKG_NAME:=gluon-mesh-batman-adv
PKG_VERSION:=2 PKG_VERSION:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(GLUONDIR)/include/package.mk
define Package/gluon-mesh-batman-adv define Package/gluon-mesh-batman-adv
SECTION:=gluon SECTION:=gluon
@ -32,4 +32,10 @@ define Package/gluon-mesh-batman-adv/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
endef endef
define Package/gluon-mesh-batman-adv/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-mesh-batman-adv)) $(eval $(call BuildPackage,gluon-mesh-batman-adv))

View File

@ -0,0 +1,10 @@
need_string('regdom')
for _, config in ipairs({'wifi24', 'wifi5'}) do
need_string(config .. '.ssid')
need_number(config .. '.channel')
need_string(config .. '.htmode')
need_string(config .. '.mesh_ssid')
need_string_match(config .. '.mesh_bssid', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$')
need_number(config .. '.mesh_mcast_rate')
end

View File

@ -1,11 +1,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-vpn-fastd PKG_NAME:=gluon-mesh-vpn-fastd
PKG_VERSION:=2 PKG_VERSION:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(GLUONDIR)/include/package.mk
define Package/gluon-mesh-vpn-fastd define Package/gluon-mesh-vpn-fastd
SECTION:=gluon SECTION:=gluon
@ -32,4 +32,9 @@ define Package/gluon-mesh-vpn-fastd/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
endef endef
define Package/gluon-mesh-vpn-fastd/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) $(eval $(call BuildPackage,gluon-mesh-vpn-fastd))

View File

@ -0,0 +1,13 @@
need_string_array 'fastd_mesh_vpn.methods'
need_number 'fastd_mesh_vpn.mtu'
need_number 'fastd_mesh_vpn.backbone.limit'
local function check_peer(k, _)
local prefix = string.format('fastd_mesh_vpn.backbone.peers[%q].', k)
need_string(prefix .. 'key')
need_string_array(prefix .. 'remotes')
end
need_table('fastd_mesh_vpn.backbone.peers', check_peer)

View File

@ -1,11 +1,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-next-node PKG_NAME:=gluon-next-node
PKG_VERSION:=2 PKG_VERSION:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(GLUONDIR)/include/package.mk
define Package/gluon-next-node define Package/gluon-next-node
SECTION:=gluon SECTION:=gluon
@ -32,4 +32,9 @@ define Package/gluon-next-node/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
endef endef
define Package/gluon-next-node/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-next-node)) $(eval $(call BuildPackage,gluon-next-node))

View File

@ -0,0 +1,4 @@
need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$')
need_string_match('next_node.ip6', '^[%x:]+$')
need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$')