gluon/package/gluon-autoupdater/invariant.pl
Daniel Ehlers 27871c0dc3 gluon-autoupdater: Enable list of mirrors for manifest and firmware.
Instead of a single url this patch allows to have a list of urls. So in case
of network instability a router can still reach local mesh-cloud server to pull
a update from. In this stage the autoupdater simply tries every mirror until
one passes all tests.
2014-01-20 23:31:15 +01:00

49 lines
774 B
Perl

my $cfg = $CONFIG->{autoupdater};
print <<'END';
#/bin/sh
uci -q get autoupdater.settings || {
uci -q batch <<EOF
set autoupdater.settings=autoupdater
END
for (qw(enabled branch)) {
print "set autoupdater.settings.$_=$cfg->{$_}\n";
}
print <<'END';
EOF
}
uci -q batch <<EOF
END
foreach my $name (sort keys $cfg->{branches}) {
my $branch = $cfg->{branches}->{$name};
print <<END;
delete autoupdater.$name
set autoupdater.$name=branch
END
for (qw(probability good_signatures)) {
print "set autoupdater.$name.$_=$branch->{$_}\n";
}
for (@{$branch->{mirrors}}) {
print "add_list autoupdater.$name.mirror=$_\n";
}
for (@{$branch->{pubkeys}}) {
print "add_list autoupdater.$name.pubkey=$_\n";
}
}
print <<END;
commit autoupdater
EOF
END