gluon-autoupdater: new branch specification
It is now possible to specific multiple branches like this: config branch stable option url ... list pubkey ... ... config branch testing ... and select one in autoupdater.settings: config autoupdater settings option branch "stable"
This commit is contained in:
parent
09855e0c80
commit
f637e923f5
@ -1,8 +1,8 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=gluon-autoupdater
|
PKG_NAME:=gluon-autoupdater
|
||||||
PKG_VERSION:=0.3.2.99
|
PKG_VERSION:=0.1
|
||||||
PKG_RELEASE:=0.1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk
|
|||||||
define Package/gluon-autoupdater
|
define Package/gluon-autoupdater
|
||||||
SECTION:=gluon
|
SECTION:=gluon
|
||||||
CATEGORY:=Gluon
|
CATEGORY:=Gluon
|
||||||
DEPENDS:=+ecdsautils +gluon-cron +gluon-release
|
DEPENDS:=+ecdsautils +gluon-cron +gluon-release +gluon-location
|
||||||
TITLE:=Automatically update firmware
|
TITLE:=Automatically update firmware
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -23,13 +23,13 @@ define Build/Configure
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Compile
|
define Build/Compile
|
||||||
$(GLUON_CONFIGURE) autoupdater.pl > $(PKG_BUILD_DIR)/autoupdater.sh
|
$(GLUON_CONFIGURE) invariant.pl > $(PKG_BUILD_DIR)/invariant.sh
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/gluon-autoupdater/install
|
define Package/gluon-autoupdater/install
|
||||||
$(CP) ./files/* $(1)/
|
$(CP) ./files/* $(1)/
|
||||||
$(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/initial
|
$(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/invariant
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/autoupdater.sh $(1)/lib/gluon/upgrade/autoupdater/initial/010-autoupdater
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/invariant.sh $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,gluon-autoupdater))
|
$(eval $(call BuildPackage,gluon-autoupdater))
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
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,6 +1,8 @@
|
|||||||
config autoupdater default
|
config autoupdater settings
|
||||||
option enabled 1
|
option enabled 1
|
||||||
option branch "stable"
|
option branch "stable"
|
||||||
|
|
||||||
|
config branch stable
|
||||||
option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate'
|
option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate'
|
||||||
|
|
||||||
# The updater will run once per hour and perform an update with a certain
|
# The updater will run once per hour and perform an update with a certain
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
uci -q delete autoupdater.settings
|
@ -0,0 +1,3 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
uci -q delete autoupdater.settings
|
@ -1,11 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if test $(uci get autoupdater.default.enabled) != 1; then
|
if test $(uci get autoupdater.settings.enabled) != 1; then
|
||||||
echo "autoupdater is disabled"
|
echo "autoupdater is disabled"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROBABILITY=$(uci get autoupdater.default.probability)
|
BRANCH=$(uci get autoupdater.settings.branch)
|
||||||
|
|
||||||
|
PROBABILITY=$(uci get autoupdater.${BRANCH}.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 +17,9 @@ if test "a$1" != "a-f"; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BASE=$(uci get autoupdater.default.url)
|
BASE=$(uci get autoupdater.${BRANCH}.url)
|
||||||
PUBKEYS=$(uci get autoupdater.default.pubkey)
|
PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey)
|
||||||
GOOD_SIGNATURES=$(uci get autoupdater.default.good_signatures)
|
GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures)
|
||||||
BRANCH=$(uci get autoupdater.default.branch)
|
|
||||||
|
|
||||||
VERSION_FILE=/lib/gluon/release
|
VERSION_FILE=/lib/gluon/release
|
||||||
|
|
||||||
|
44
package/gluon-autoupdater/invariant.pl
Normal file
44
package/gluon-autoupdater/invariant.pl
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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(url probability good_signatures)) {
|
||||||
|
print "set autoupdater.$name.$_=$branch->{$_}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (@{$branch->{pubkeys}}) {
|
||||||
|
print "add_list autoupdater.$name.pubkey=$_\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<END;
|
||||||
|
|
||||||
|
commit autoupdater
|
||||||
|
EOF
|
||||||
|
END
|
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
OLD_CFG=/etc/config/config_mode
|
||||||
|
NEW_CFG=/etc/config/configmode
|
||||||
|
|
||||||
|
[ -f $OLD_CFG ] && mv $OLD_CFG $NEW_CFG
|
Loading…
Reference in New Issue
Block a user