Browse Source

gluon-simple-tc: add site validator

Matthias Schiffer 10 years ago
parent
commit
f792997bb1
2 changed files with 17 additions and 2 deletions
  1. 7 2
      package/gluon-simple-tc/Makefile
  2. 10 0
      package/gluon-simple-tc/check_site.lua

+ 7 - 2
package/gluon-simple-tc/Makefile

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

+ 10 - 0
package/gluon-simple-tc/check_site.lua

@@ -0,0 +1,10 @@
+local function check_entry(k, _)
+   local prefix = string.format('simple_tc[%q].', k)
+
+   need_string(prefix .. 'ifname')
+   need_boolean(prefix .. 'enabled')
+   need_number(prefix .. 'limit_egress')
+   need_number(prefix .. 'limit_ingress')
+end
+
+need_table('simple_tc', check_entry)