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

View File

@ -1,23 +1,18 @@
my $cfg = $CONFIG->{simple_tc}; my $cfg = $CONFIG->{simple_tc};
print <<'END'; print "#/bin/sh\n\n";
#/bin/sh
uci -q batch <<EOF
END
foreach my $name (sort keys %{$cfg}) { foreach my $name (sort keys %{$cfg}) {
my $interface = $cfg->{$name}; 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"; print "set gluon-simple-tc.$name=interface\n";
for (qw(enabled ifname limit_egress limit_ingress)) { for (qw(enabled ifname limit_egress limit_ingress)) {
print "set gluon-simple-tc.$name.$_=$interface->{$_}\n"; print "set gluon-simple-tc.$name.$_=$interface->{$_}\n";
} }
print "EOF\n\n";
} }
print <<END; print "uci commit gluon-simple-tc\n";
commit gluon-simple-tc
EOF
END