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.
This commit is contained in:
Daniel Ehlers 2014-01-20 00:10:05 +01:00
parent cb6c025a7f
commit 27871c0dc3
2 changed files with 16 additions and 3 deletions

View File

@ -19,7 +19,7 @@ if test "a$1" != "a-f"; then
fi fi
fi fi
BASE=$(uci get autoupdater.${BRANCH}.url) MIRRORS=$(uci get autoupdater.${BRANCH}.mirror)
PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey) PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey)
GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures) GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures)
@ -166,4 +166,13 @@ fi
my_version="$(cat "$VERSION_FILE")" my_version="$(cat "$VERSION_FILE")"
autoupdate $BASE && exit 0 for mirror in $MIRRORS; do
autoupdate $mirror && exit 0
unset fw_version
unset fw_md5
unset fw_file
done

View File

@ -28,10 +28,14 @@ delete autoupdater.$name
set autoupdater.$name=branch set autoupdater.$name=branch
END END
for (qw(url probability good_signatures)) { for (qw(probability good_signatures)) {
print "set autoupdater.$name.$_=$branch->{$_}\n"; print "set autoupdater.$name.$_=$branch->{$_}\n";
} }
for (@{$branch->{mirrors}}) {
print "add_list autoupdater.$name.mirror=$_\n";
}
for (@{$branch->{pubkeys}}) { for (@{$branch->{pubkeys}}) {
print "add_list autoupdater.$name.pubkey=$_\n"; print "add_list autoupdater.$name.pubkey=$_\n";
} }