summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2018-04-06 15:26:17 +0200
committerPatrick Vacek <patrickvacek@gmail.com>2018-04-13 12:30:09 +0200
commite109b8cde37bd1d0bbefc37d39c169b57b7957d4 (patch)
tree763d4f6300c47bcda3d8138c92cc3c2eb93ec128
parentdc8096010ebcb4b5110db50456a892fde12a9f4a (diff)
downloadmeta-updater-e109b8cde37bd1d0bbefc37d39c169b57b7957d4.tar.gz
If GARAGE_SIGN_VERSION is not provided, ask the server for a version.
Get the server URL out of the credentials and ask what version the server is using.
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb4
-rw-r--r--recipes-sota/aktualizr/garage-sign-version.inc23
2 files changed, 26 insertions, 1 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 4305b2c..abe8f5b 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -22,7 +22,7 @@ SRC_URI = " \
22 file://aktualizr-secondary.socket \ 22 file://aktualizr-secondary.socket \
23 file://aktualizr-serialcan.service \ 23 file://aktualizr-serialcan.service \
24 " 24 "
25SRCREV = "930d8eef6eb584686654601c056d7c9c6fca3048" 25SRCREV = "7ccfc5b4286b9a04915e74a7474a8d3451145e1c"
26BRANCH ?= "master" 26BRANCH ?= "master"
27 27
28S = "${WORKDIR}/git" 28S = "${WORKDIR}/git"
@@ -37,6 +37,8 @@ SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket"
37 37
38BBCLASSEXTEND =+ "native" 38BBCLASSEXTEND =+ "native"
39 39
40require garage-sign-version.inc
41
40EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF \ 42EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF \
41 -DCMAKE_BUILD_TYPE=Release \ 43 -DCMAKE_BUILD_TYPE=Release \
42 -DAKTUALIZR_VERSION=${PV} " 44 -DAKTUALIZR_VERSION=${PV} "
diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc
new file mode 100644
index 0000000..2d08cdf
--- /dev/null
+++ b/recipes-sota/aktualizr/garage-sign-version.inc
@@ -0,0 +1,23 @@
1
2python () {
3 if d.getVar("GARAGE_SIGN_VERSION", True) or not d.getVar("SOTA_PACKED_CREDENTIALS", True):
4 return
5 import json
6 import urllib.request
7 import zipfile
8 with zipfile.ZipFile(d.getVar("SOTA_PACKED_CREDENTIALS", True), 'r') as zip_ref:
9 try:
10 with zip_ref.open('tufrepo.url', mode='r') as url_file:
11 url = url_file.read().decode() + '/health/version'
12 except (KeyError, ValueError, RuntimeError):
13 return
14 r = urllib.request.urlopen(url)
15 if r.code != 200:
16 return
17 resp = r.read()
18 j = json.loads(resp)
19 version = 'cli-' + j['version'] + '.tgz'
20 d.setVar("GARAGE_SIGN_VERSION", version)
21}
22
23# vim:set ts=4 sw=4 sts=4 expandtab: