Skip to content
Snippets Groups Projects
Commit 156813b3 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-simple-tc: replace config script generator with Lua script

parent ee307ec1
No related branches found
No related tags found
No related merge requests found
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))
#!/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')
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";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment