gluon-simple-tc: add missing defaults on every upgrade

This commit is contained in:
Matthias Schiffer 2014-01-19 23:33:52 +01:00
parent f9cb8a7258
commit 8f7b59d787
2 changed files with 8 additions and 13 deletions

View File

@ -27,13 +27,13 @@ define Build/Configure
endef
define Build/Compile
$(GLUON_CONFIGURE) initial.pl > $(PKG_BUILD_DIR)/initial.sh
$(GLUON_CONFIGURE) invariant.pl > $(PKG_BUILD_DIR)/invariant.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
$(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/invariant
$(INSTALL_BIN) $(PKG_BUILD_DIR)/invariant.sh $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults
endef
$(eval $(call BuildPackage,gluon-simple-tc))

View File

@ -1,23 +1,18 @@
my $cfg = $CONFIG->{simple_tc};
print <<'END';
#/bin/sh
uci -q batch <<EOF
END
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 <<END;
commit gluon-simple-tc
EOF
END
print "uci commit gluon-simple-tc\n";