From edcc57397615c0db394f5af4361d262f263d9d4a Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 2 Oct 2013 13:33:47 +0200 Subject: [PATCH] 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" --- gluon/gluon-autoupdater/Makefile | 12 ++--- gluon/gluon-autoupdater/autoupdater.pl | 23 ---------- .../files/etc/config/autoupdater | 34 +++++++------- .../lib/gluon/upgrade/autoupdater/010-initial | 3 ++ .../upgrade/autoupdater/initial/010-initial | 3 ++ .../files/usr/sbin/autoupdater | 13 +++--- gluon/gluon-autoupdater/invariant.pl | 44 +++++++++++++++++++ .../invariant/001-migrate-uci-config | 6 +++ 8 files changed, 87 insertions(+), 51 deletions(-) delete mode 100644 gluon/gluon-autoupdater/autoupdater.pl create mode 100755 gluon/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/010-initial create mode 100755 gluon/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial create mode 100644 gluon/gluon-autoupdater/invariant.pl create mode 100755 gluon/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config diff --git a/gluon/gluon-autoupdater/Makefile b/gluon/gluon-autoupdater/Makefile index 43d9beb..8d6ae75 100644 --- a/gluon/gluon-autoupdater/Makefile +++ b/gluon/gluon-autoupdater/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-autoupdater -PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=0.1 +PKG_VERSION:=0.1 +PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+ecdsautils +gluon-cron +gluon-release + DEPENDS:=+ecdsautils +gluon-cron +gluon-release +gluon-location TITLE:=Automatically update firmware endef @@ -23,13 +23,13 @@ define Build/Configure endef define Build/Compile - $(GLUON_CONFIGURE) autoupdater.pl > $(PKG_BUILD_DIR)/autoupdater.sh + $(GLUON_CONFIGURE) invariant.pl > $(PKG_BUILD_DIR)/invariant.sh endef define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/initial - $(INSTALL_BIN) $(PKG_BUILD_DIR)/autoupdater.sh $(1)/lib/gluon/upgrade/autoupdater/initial/010-autoupdater + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/invariant + $(INSTALL_BIN) $(PKG_BUILD_DIR)/invariant.sh $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater endef $(eval $(call BuildPackage,gluon-autoupdater)) diff --git a/gluon/gluon-autoupdater/autoupdater.pl b/gluon/gluon-autoupdater/autoupdater.pl deleted file mode 100644 index 88bac9f..0000000 --- a/gluon/gluon-autoupdater/autoupdater.pl +++ /dev/null @@ -1,23 +0,0 @@ -my $cfg = $CONFIG->{autoupdater}; - -print <<'END'; -#/bin/sh - -uci -q batch < $PROBABILITY}" @@ -15,10 +17,9 @@ if test "a$1" != "a-f"; then fi fi -BASE=$(uci get autoupdater.default.url) -PUBKEYS=$(uci get autoupdater.default.pubkey) -GOOD_SIGNATURES=$(uci get autoupdater.default.good_signatures) -BRANCH=$(uci get autoupdater.default.branch) +BASE=$(uci get autoupdater.${BRANCH}.url) +PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey) +GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures) VERSION_FILE=/lib/gluon/release diff --git a/gluon/gluon-autoupdater/invariant.pl b/gluon/gluon-autoupdater/invariant.pl new file mode 100644 index 0000000..3184813 --- /dev/null +++ b/gluon/gluon-autoupdater/invariant.pl @@ -0,0 +1,44 @@ +my $cfg = $CONFIG->{autoupdater}; + +print <<'END'; +#/bin/sh + +uci -q get autoupdater.settings || { +uci -q batch <{$_}\n"; +} + +print <<'END'; +EOF +} + +uci -q batch <{branches}) { + my $branch = $cfg->{branches}->{$name}; + + print <{$_}\n"; + } + + for (@{$branch->{pubkeys}}) { + print "add_list autoupdater.$name.pubkey=$_\n"; + } +} + +print <