gluon-simple-tc: create initial config from site.conf
This commit is contained in:
parent
7edb775444
commit
903d157550
@ -27,10 +27,13 @@ define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(GLUON_CONFIGURE) initial.pl > $(PKG_BUILD_DIR)/initial.sh
|
||||
endef
|
||||
|
||||
define Package/gluon-simple-tc/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/initial
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/initial.sh $(1)/lib/gluon/upgrade/simple-tc/initial/010-site-defaults
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gluon-simple-tc))
|
||||
|
21
package/gluon-simple-tc/initial.pl
Normal file
21
package/gluon-simple-tc/initial.pl
Normal file
@ -0,0 +1,21 @@
|
||||
my $cfg = $CONFIG->{simple_tc};
|
||||
|
||||
print <<'END';
|
||||
#/bin/sh
|
||||
|
||||
uci -q batch <<EOF
|
||||
END
|
||||
|
||||
while (($name, $interface) = each %{$cfg}) {
|
||||
print "set gluon-simple-tc.$name=interface\n";
|
||||
|
||||
for (qw(ifname enabled limit_egress limit_ingress)) {
|
||||
print "set gluon-simple-tc.$name.$_=$interface->{$_}\n";
|
||||
}
|
||||
}
|
||||
|
||||
print <<END;
|
||||
|
||||
commit gluon-simple-tc
|
||||
EOF
|
||||
END
|
Loading…
Reference in New Issue
Block a user