gluon-simple-tc: create initial config from site.conf

This commit is contained in:
Nils Schneider 2013-10-03 21:10:29 +02:00
parent 7edb775444
commit 903d157550
2 changed files with 24 additions and 0 deletions

View File

@ -27,10 +27,13 @@ define Build/Configure
endef endef
define Build/Compile define Build/Compile
$(GLUON_CONFIGURE) initial.pl > $(PKG_BUILD_DIR)/initial.sh
endef endef
define Package/gluon-simple-tc/install define Package/gluon-simple-tc/install
$(CP) ./files/* $(1)/ $(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 endef
$(eval $(call BuildPackage,gluon-simple-tc)) $(eval $(call BuildPackage,gluon-simple-tc))

View 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