gluon-autoupdater: read config from site.conf
This commit is contained in:
parent
01da55cdd4
commit
fd4222f65d
@ -23,11 +23,13 @@ define Build/Configure
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Compile
|
define Build/Compile
|
||||||
|
$(GLUON_CONFIGURE) autoupdater.pl > $(PKG_BUILD_DIR)/autoupdater.sh
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/gluon-autoupdater/install
|
define Package/gluon-autoupdater/install
|
||||||
$(CP) ./files/* $(1)/
|
$(CP) ./files/* $(1)/
|
||||||
chmod +x $(1)/usr/sbin/autoupdate
|
$(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/initial
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/autoupdater.sh $(1)/lib/gluon/upgrade/autoupdater/initial/010-autoupdater
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,gluon-autoupdater))
|
$(eval $(call BuildPackage,gluon-autoupdater))
|
||||||
|
23
package/gluon-autoupdater/autoupdater.pl
Normal file
23
package/gluon-autoupdater/autoupdater.pl
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
my $cfg = $CONFIG->{autoupdater};
|
||||||
|
|
||||||
|
print <<'END';
|
||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<EOF
|
||||||
|
delete autoupdater.default
|
||||||
|
set autoupdater.default=autoupdater
|
||||||
|
END
|
||||||
|
|
||||||
|
for (qw(enabled branch url probability good_signatures)) {
|
||||||
|
print 'set autoupdater.default.' . $_ . '=' . $cfg->{$_} . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (@{$cfg->{pubkeys}}) {
|
||||||
|
print 'add_list autoupdater.default.pubkey=' . $_ . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<END;
|
||||||
|
|
||||||
|
commit autoupdater
|
||||||
|
EOF
|
||||||
|
END
|
@ -1,4 +1,4 @@
|
|||||||
config autoupdater
|
config autoupdater default
|
||||||
option enabled 1
|
option enabled 1
|
||||||
option branch "stable"
|
option branch "stable"
|
||||||
option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate'
|
option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate'
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if test $(uci get autoupdater.@autoupdater[0].enabled) != 1; then
|
if test $(uci get autoupdater.default.enabled) != 1; then
|
||||||
echo "autoupdater is disabled"
|
echo "autoupdater is disabled"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROBABILITY=$(uci get autoupdater.@autoupdater[0].probability)
|
PROBABILITY=$(uci get autoupdater.default.probability)
|
||||||
|
|
||||||
if test "a$1" != "a-f"; then
|
if test "a$1" != "a-f"; then
|
||||||
echo | awk "END{srand();exit rand() > $PROBABILITY}"
|
echo | awk "END{srand();exit rand() > $PROBABILITY}"
|
||||||
@ -15,10 +15,10 @@ if test "a$1" != "a-f"; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BASE=$(uci get autoupdater.@autoupdater[0].url)
|
BASE=$(uci get autoupdater.default.url)
|
||||||
PUBKEYS=$(uci get autoupdater.@autoupdater[0].pubkey)
|
PUBKEYS=$(uci get autoupdater.default.pubkey)
|
||||||
GOOD_SIGNATURES=$(uci get autoupdater.@autoupdater[0].good_signatures)
|
GOOD_SIGNATURES=$(uci get autoupdater.default.good_signatures)
|
||||||
BRANCH=$(uci get autoupdater.@autoupdater[0].branch)
|
BRANCH=$(uci get autoupdater.default.branch)
|
||||||
|
|
||||||
VERSION_FILE=/lib/gluon/release
|
VERSION_FILE=/lib/gluon/release
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user