summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2018-03-29 13:51:03 +0200
committerPatrick Vacek <patrickvacek@gmail.com>2018-04-12 12:10:55 +0200
commitdd7f7d88ce253fce6a8c2675f58ee214586f3f08 (patch)
treee4c414403fdaf54c9b13267bf0ba5d11ce8b4865
parent6607b218b3391b5558c6d1fad529c60caf6639c9 (diff)
downloadmeta-updater-dd7f7d88ce253fce6a8c2675f58ee214586f3f08.tar.gz
Assorted minor cleanup and formatting.
Includes the suggestion for using /etc/sota/sota.env if it exists as recommended by the discussion here: https://github.com/advancedtelematic/meta-updater/pull/275 Partial cherry-pick of 71c528ab616a707f4125727c8c5a4e4da5a36c94 from rocko.
-rw-r--r--classes/image_types_ostree.bbclass25
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb3
-rw-r--r--recipes-sota/aktualizr/environment.inc2
-rw-r--r--recipes-sota/aktualizr/files/aktualizr.service1
4 files changed, 23 insertions, 8 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index dcc376d..2d1fb25 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -11,7 +11,6 @@ IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \
11 11
12export OSTREE_REPO 12export OSTREE_REPO
13export OSTREE_BRANCHNAME 13export OSTREE_BRANCHNAME
14
15export GARAGE_TARGET_NAME 14export GARAGE_TARGET_NAME
16 15
17RAMDISK_EXT ?= ".ext4.gz" 16RAMDISK_EXT ?= ".ext4.gz"
@@ -198,7 +197,9 @@ IMAGE_CMD_garagesign () {
198 fi 197 fi
199 198
200 rm -rf ${GARAGE_SIGN_REPO} 199 rm -rf ${GARAGE_SIGN_REPO}
201 garage-sign init --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} 200 garage-sign init --repo tufrepo \
201 --home-dir ${GARAGE_SIGN_REPO} \
202 --credentials ${SOTA_PACKED_CREDENTIALS}
202 203
203 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) 204 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME})
204 205
@@ -206,11 +207,23 @@ IMAGE_CMD_garagesign () {
206 # in which case targets.json should be pulled again and the whole procedure repeated 207 # in which case targets.json should be pulled again and the whole procedure repeated
207 push_success=0 208 push_success=0
208 for push_retries in $( seq 3 ); do 209 for push_retries in $( seq 3 ); do
209 garage-sign targets pull --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} 210 garage-sign targets pull --repo tufrepo \
210 garage-sign targets add --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --name ${GARAGE_TARGET_NAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} 211 --home-dir ${GARAGE_SIGN_REPO}
211 garage-sign targets sign --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --key-name=targets 212 garage-sign targets add --repo tufrepo \
213 --home-dir ${GARAGE_SIGN_REPO} \
214 --name ${GARAGE_TARGET_NAME} \
215 --format OSTREE \
216 --version ${ostree_target_hash} \
217 --length 0 \
218 --url "https://example.com/" \
219 --sha256 ${ostree_target_hash} \
220 --hardwareids ${MACHINE}
221 garage-sign targets sign --repo tufrepo \
222 --home-dir ${GARAGE_SIGN_REPO} \
223 --key-name=targets
212 errcode=0 224 errcode=0
213 garage-sign targets push --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} || errcode=$? 225 garage-sign targets push --repo tufrepo \
226 --home-dir ${GARAGE_SIGN_REPO} || errcode=$?
214 if [ "$errcode" -eq "0" ]; then 227 if [ "$errcode" -eq "0" ]; then
215 push_success=1 228 push_success=1
216 break 229 break
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index e01c3b0..1dd1016 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -20,7 +20,7 @@ SRC_URI = " \
20 file://aktualizr.service \ 20 file://aktualizr.service \
21 file://aktualizr-serialcan.service \ 21 file://aktualizr-serialcan.service \
22 " 22 "
23SRCREV = "1a6432175b9fb7326173e8db35d326cc1a1011a1" 23SRCREV = "930d8eef6eb584686654601c056d7c9c6fca3048"
24BRANCH ?= "master" 24BRANCH ?= "master"
25 25
26S = "${WORKDIR}/git" 26S = "${WORKDIR}/git"
@@ -39,6 +39,7 @@ EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF "
39do_install_append () { 39do_install_append () {
40 rm -fr ${D}${libdir}/systemd 40 rm -fr ${D}${libdir}/systemd
41} 41}
42
42do_install_append_class-target () { 43do_install_append_class-target () {
43 rm -f ${D}${bindir}/aktualizr_cert_provider 44 rm -f ${D}${bindir}/aktualizr_cert_provider
44 rm -f ${D}${bindir}/aktualizr_implicit_writer 45 rm -f ${D}${bindir}/aktualizr_implicit_writer
diff --git a/recipes-sota/aktualizr/environment.inc b/recipes-sota/aktualizr/environment.inc
index cba77e7..09da6b7 100644
--- a/recipes-sota/aktualizr/environment.inc
+++ b/recipes-sota/aktualizr/environment.inc
@@ -3,7 +3,7 @@ export SOTA_VIRTUAL_SECONDARIES
3 3
4do_install_append() { 4do_install_append() {
5 if [ -n "${SOTA_LEGACY_SECONDARY_INTERFACE}" ]; then 5 if [ -n "${SOTA_LEGACY_SECONDARY_INTERFACE}" ]; then
6 AKTUALIZR_PARAMETERS_LEGACYSEC="--legacy-interface ${SOTA_LEGACY_SECONDARY_INTERFACE}"; 6 AKTUALIZR_PARAMETERS_LEGACYSEC="--legacy-interface ${SOTA_LEGACY_SECONDARY_INTERFACE}"
7 fi 7 fi
8 8
9 AKTUALIZR_PARAMETERS_CONFIGFILE="--config /usr/lib/sota/sota.toml" 9 AKTUALIZR_PARAMETERS_CONFIGFILE="--config /usr/lib/sota/sota.toml"
diff --git a/recipes-sota/aktualizr/files/aktualizr.service b/recipes-sota/aktualizr/files/aktualizr.service
index b6df9d7..1c2e1df 100644
--- a/recipes-sota/aktualizr/files/aktualizr.service
+++ b/recipes-sota/aktualizr/files/aktualizr.service
@@ -8,6 +8,7 @@ Requires=network-online.target
8RestartSec=10 8RestartSec=10
9Restart=always 9Restart=always
10EnvironmentFile=/usr/lib/sota/sota.env 10EnvironmentFile=/usr/lib/sota/sota.env
11EnvironmentFile=-/etc/sota/sota.env
11ExecStart=/usr/bin/aktualizr $AKTUALIZR_CMDLINE_PARAMETERS 12ExecStart=/usr/bin/aktualizr $AKTUALIZR_CMDLINE_PARAMETERS
12 13
13[Install] 14[Install]