From dd7f7d88ce253fce6a8c2675f58ee214586f3f08 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 29 Mar 2018 13:51:03 +0200 Subject: 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. --- classes/image_types_ostree.bbclass | 25 +++++++++++++++++++------ recipes-sota/aktualizr/aktualizr_git.bb | 3 ++- recipes-sota/aktualizr/environment.inc | 2 +- recipes-sota/aktualizr/files/aktualizr.service | 1 + 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 \ export OSTREE_REPO export OSTREE_BRANCHNAME - export GARAGE_TARGET_NAME RAMDISK_EXT ?= ".ext4.gz" @@ -198,7 +197,9 @@ IMAGE_CMD_garagesign () { fi rm -rf ${GARAGE_SIGN_REPO} - garage-sign init --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} + garage-sign init --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} \ + --credentials ${SOTA_PACKED_CREDENTIALS} ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) @@ -206,11 +207,23 @@ IMAGE_CMD_garagesign () { # in which case targets.json should be pulled again and the whole procedure repeated push_success=0 for push_retries in $( seq 3 ); do - garage-sign targets pull --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} - 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} - garage-sign targets sign --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --key-name=targets + garage-sign targets pull --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} + 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} + garage-sign targets sign --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} \ + --key-name=targets errcode=0 - garage-sign targets push --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} || errcode=$? + garage-sign targets push --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} || errcode=$? if [ "$errcode" -eq "0" ]; then push_success=1 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 = " \ file://aktualizr.service \ file://aktualizr-serialcan.service \ " -SRCREV = "1a6432175b9fb7326173e8db35d326cc1a1011a1" +SRCREV = "930d8eef6eb584686654601c056d7c9c6fca3048" BRANCH ?= "master" S = "${WORKDIR}/git" @@ -39,6 +39,7 @@ EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF " do_install_append () { rm -fr ${D}${libdir}/systemd } + do_install_append_class-target () { rm -f ${D}${bindir}/aktualizr_cert_provider 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 do_install_append() { if [ -n "${SOTA_LEGACY_SECONDARY_INTERFACE}" ]; then - AKTUALIZR_PARAMETERS_LEGACYSEC="--legacy-interface ${SOTA_LEGACY_SECONDARY_INTERFACE}"; + AKTUALIZR_PARAMETERS_LEGACYSEC="--legacy-interface ${SOTA_LEGACY_SECONDARY_INTERFACE}" fi 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 RestartSec=10 Restart=always EnvironmentFile=/usr/lib/sota/sota.env +EnvironmentFile=-/etc/sota/sota.env ExecStart=/usr/bin/aktualizr $AKTUALIZR_CMDLINE_PARAMETERS [Install] -- cgit v1.2.3-54-g00ecf