summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2018-03-29 13:51:03 +0200
committerPatrick Vacek <patrickvacek@gmail.com>2018-03-29 13:57:58 +0200
commit71c528ab616a707f4125727c8c5a4e4da5a36c94 (patch)
tree5ea8f1929b8951dfafa568732bc5f3023bd17f8a
parentbca6c0b09593c77d9ac78caae2f7488adb1d90f4 (diff)
downloadmeta-updater-71c528ab616a707f4125727c8c5a4e4da5a36c94.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
-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
-rw-r--r--recipes-test/images/primary-image.bb2
-rw-r--r--recipes-test/images/secondary-image.bb2
6 files changed, 27 insertions, 8 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 5ebed81..dc14e4a 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -11,7 +11,6 @@ do_image_ostree[depends] += "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 26ccd72..2a803a8 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 = "178ba9985e23d9c3938d87dd5f2cb39f48f61de6" 25SRCREV = "930d8eef6eb584686654601c056d7c9c6fca3048"
26BRANCH ?= "master" 26BRANCH ?= "master"
27 27
28S = "${WORKDIR}/git" 28S = "${WORKDIR}/git"
@@ -50,6 +50,7 @@ do_install_append () {
50 install -m 0644 ${WORKDIR}/aktualizr-secondary.socket ${D}${systemd_unitdir}/system/aktualizr-secondary.socket 50 install -m 0644 ${WORKDIR}/aktualizr-secondary.socket ${D}${systemd_unitdir}/system/aktualizr-secondary.socket
51 install -m 0644 ${WORKDIR}/aktualizr-secondary.service ${D}${systemd_unitdir}/system/aktualizr-secondary.service 51 install -m 0644 ${WORKDIR}/aktualizr-secondary.service ${D}${systemd_unitdir}/system/aktualizr-secondary.service
52} 52}
53
53do_install_append_class-target () { 54do_install_append_class-target () {
54 install -d ${D}${systemd_unitdir}/system 55 install -d ${D}${systemd_unitdir}/system
55 aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} 56 aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)}
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]
diff --git a/recipes-test/images/primary-image.bb b/recipes-test/images/primary-image.bb
index 6c06527..6d2df94 100644
--- a/recipes-test/images/primary-image.bb
+++ b/recipes-test/images/primary-image.bb
@@ -10,3 +10,5 @@ IMAGE_INSTALL_remove = " \
10IMAGE_INSTALL_append = " \ 10IMAGE_INSTALL_append = " \
11 primary-network-config \ 11 primary-network-config \
12 " 12 "
13
14# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/images/secondary-image.bb b/recipes-test/images/secondary-image.bb
index 02153d0..9adbdc5 100644
--- a/recipes-test/images/secondary-image.bb
+++ b/recipes-test/images/secondary-image.bb
@@ -21,3 +21,5 @@ IMAGE_INSTALL_append = " \
21 aktualizr-secondary \ 21 aktualizr-secondary \
22 secondary-network-config \ 22 secondary-network-config \
23 " 23 "
24
25# vim:set ts=4 sw=4 sts=4 expandtab: