gluon-simple-tc: replace config script generator with Lua script
This commit is contained in:
parent
ee307ec1de
commit
156813b34f
@ -1,8 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gluon-simple-tc
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION)
|
||||
PKG_VERSION:=2
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
@ -31,10 +30,6 @@ endef
|
||||
|
||||
define Package/gluon-simple-tc/install
|
||||
$(CP) ./files/* $(1)/
|
||||
|
||||
$(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/invariant
|
||||
$(GLUON_CONFIGURE) invariant.pl > $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults
|
||||
chmod +x $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gluon-simple-tc))
|
||||
|
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
|
||||
for name, config in pairs(site.simple_tc) do
|
||||
if not c:get('gluon-simple-tc', name) then
|
||||
c:section('gluon-simple-tc', 'interface', name, config)
|
||||
end
|
||||
end
|
||||
|
||||
c:save('gluon-simple-tc')
|
||||
c:commit('gluon-simple-tc')
|
@ -1,18 +0,0 @@
|
||||
my $cfg = $CONFIG->{simple_tc};
|
||||
|
||||
print "#/bin/sh\n\n";
|
||||
|
||||
foreach my $name (sort keys %{$cfg}) {
|
||||
my $interface = $cfg->{$name};
|
||||
|
||||
print "uci -q get gluon-simple-tc.$name >/dev/null || uci -q batch <<EOF\n";
|
||||
print "set gluon-simple-tc.$name=interface\n";
|
||||
|
||||
for (qw(enabled ifname limit_egress limit_ingress)) {
|
||||
print "set gluon-simple-tc.$name.$_=$interface->{$_}\n";
|
||||
}
|
||||
|
||||
print "EOF\n\n";
|
||||
}
|
||||
|
||||
print "uci commit gluon-simple-tc\n";
|
Loading…
Reference in New Issue
Block a user