From ff5efc4b3d11b6fabca831695337ceef50cc9255 Mon Sep 17 00:00:00 2001 From: Shaun Taheri Date: Tue, 11 Jul 2017 17:11:11 +0200 Subject: Split rvi-sota-client into multiple binaries --- classes/image_types_ostree.bbclass | 6 +- .../rvi-sota-client/files/sota-installer.service | 12 ++ recipes-sota/rvi-sota-client/rvi-sota-client.inc | 143 ++++++++++++++ .../rvi-sota-client/rvi-sota-client_git.bb | 208 --------------------- recipes-sota/rvi-sota-client/sota-client_git.bb | 58 ++++++ recipes-sota/rvi-sota-client/sota-installer_git.bb | 25 +++ recipes-sota/rvi-sota-client/sota-launcher_git.bb | 15 ++ 7 files changed, 258 insertions(+), 209 deletions(-) create mode 100644 recipes-sota/rvi-sota-client/files/sota-installer.service create mode 100644 recipes-sota/rvi-sota-client/rvi-sota-client.inc delete mode 100644 recipes-sota/rvi-sota-client/rvi-sota-client_git.bb create mode 100644 recipes-sota/rvi-sota-client/sota-client_git.bb create mode 100644 recipes-sota/rvi-sota-client/sota-installer_git.bb create mode 100644 recipes-sota/rvi-sota-client/sota-launcher_git.bb diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 72d7df5..ac7cb60 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -146,6 +146,8 @@ IMAGE_CMD_ostree () { fi # deploy SOTA credentials + mkdir -p var/sota + if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="` @@ -153,7 +155,6 @@ IMAGE_CMD_ostree () { bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}" fi - mkdir -p var/sota cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}` @@ -161,6 +162,9 @@ IMAGE_CMD_ostree () { echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env fi + if [ -n "${SOTA_SECONDARY_ECUS}" ]; then + cp ${SOTA_SECONDARY_ECUS} var/sota/ecus + fi # Creating boot directories is required for "ostree admin deploy" diff --git a/recipes-sota/rvi-sota-client/files/sota-installer.service b/recipes-sota/rvi-sota-client/files/sota-installer.service new file mode 100644 index 0000000..a4fd99e --- /dev/null +++ b/recipes-sota/rvi-sota-client/files/sota-installer.service @@ -0,0 +1,12 @@ +[Unit] +Description=SOTA Secondary ECU Installer +Requires=network-online.target +After=network-online.target + +[Service] +RestartSec=10 +Restart=always +ExecStart=/usr/bin/sota-installer --level debug --oneshot --config /var/sota/installer.toml + +[Install] +WantedBy=multi-user.target diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client.inc b/recipes-sota/rvi-sota-client/rvi-sota-client.inc new file mode 100644 index 0000000..8e96a32 --- /dev/null +++ b/recipes-sota/rvi-sota-client/rvi-sota-client.inc @@ -0,0 +1,143 @@ +inherit cargo systemd + +DESCRIPTION = "rvi-sota-client recipe" +HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea" + +BBCLASSEXTEND = "native" + +S = "${WORKDIR}/git" + +SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d" +SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2" + +# also update PV and SRC_URI crates when updating SRCREV +SRCREV = "1755f1d5df05cd2924b8cf505f537f04c24f568f" + +# generate with: `make package-version` +PV = "0.2.33-56-g1755f1d" + +# generate with: `make yocto-version` +SRC_URI = " \ +git://github.com/advancedtelematic/rvi_sota_client \ +file://sota-client-autoprovision.service \ +file://sota-client-ostree.service \ +file://sota-client-uptane.service \ +file://sota-installer.service \ +crate://crates.io/advapi32-sys/0.2.0 \ +crate://crates.io/aho-corasick/0.6.3 \ +crate://crates.io/ansi_term/0.9.0 \ +crate://crates.io/antidote/1.0.0 \ +crate://crates.io/atty/0.2.2 \ +crate://crates.io/backtrace/0.3.2 \ +crate://crates.io/backtrace-sys/0.1.11 \ +crate://crates.io/base64/0.5.2 \ +crate://crates.io/bit-set/0.4.0 \ +crate://crates.io/bit-vec/0.4.4 \ +crate://crates.io/bitflags/0.9.1 \ +crate://crates.io/byteorder/1.1.0 \ +crate://crates.io/bytes/0.4.4 \ +crate://crates.io/cfg-if/0.1.2 \ +crate://crates.io/chan/0.1.19 \ +crate://crates.io/chan-signal/0.2.0 \ +crate://crates.io/chrono/0.4.0 \ +crate://crates.io/clap/2.25.0 \ +crate://crates.io/core-foundation/0.2.3 \ +crate://crates.io/core-foundation-sys/0.2.3 \ +crate://crates.io/crossbeam/0.2.10 \ +crate://crates.io/crypt32-sys/0.2.0 \ +crate://crates.io/dbghelp-sys/0.2.0 \ +crate://crates.io/dbus/0.5.3 \ +crate://crates.io/dtoa/0.4.1 \ +crate://crates.io/env_logger/0.4.3 \ +crate://crates.io/error-chain/0.10.0 \ +crate://crates.io/filetime/0.1.10 \ +crate://crates.io/foreign-types/0.2.0 \ +crate://crates.io/gcc/0.3.51 \ +crate://crates.io/getopts/0.2.14 \ +crate://crates.io/hex/0.2.0 \ +crate://crates.io/httparse/1.2.3 \ +crate://crates.io/hyper/0.10.12 \ +crate://crates.io/hyper-native-tls/0.2.4 \ +crate://crates.io/idna/0.1.4 \ +crate://crates.io/iovec/0.1.0 \ +crate://crates.io/itoa/0.3.1 \ +crate://crates.io/kernel32-sys/0.2.2 \ +crate://crates.io/language-tags/0.2.2 \ +crate://crates.io/lazy_static/0.2.8 \ +crate://crates.io/libc/0.2.26 \ +crate://crates.io/libflate/0.1.5 \ +crate://crates.io/log/0.3.8 \ +crate://crates.io/maplit/0.1.4 \ +crate://crates.io/matches/0.1.6 \ +crate://crates.io/memchr/1.0.1 \ +crate://crates.io/metadeps/1.1.2 \ +crate://crates.io/mime/0.2.6 \ +crate://crates.io/native-tls/0.1.4 \ +crate://crates.io/net2/0.2.29 \ +crate://crates.io/num/0.1.40 \ +crate://crates.io/num-integer/0.1.35 \ +crate://crates.io/num-iter/0.1.34 \ +crate://crates.io/num-traits/0.1.40 \ +crate://crates.io/num_cpus/1.6.2 \ +crate://crates.io/openssl/0.9.14 \ +crate://crates.io/openssl-sys/0.9.14 \ +crate://crates.io/pem/0.4.0 \ +crate://crates.io/percent-encoding/1.0.0 \ +crate://crates.io/pkg-config/0.3.9 \ +crate://crates.io/quote/0.3.15 \ +crate://crates.io/rand/0.3.15 \ +crate://crates.io/redox_syscall/0.1.26 \ +crate://crates.io/regex/0.2.2 \ +crate://crates.io/regex-syntax/0.4.1 \ +crate://crates.io/reqwest/0.6.2 \ +crate://crates.io/ring/0.7.1 \ +crate://crates.io/rust-crypto/0.2.36 \ +crate://crates.io/rustc-demangle/0.1.4 \ +crate://crates.io/rustc-serialize/0.3.24 \ +crate://crates.io/schannel/0.1.7 \ +crate://crates.io/secur32-sys/0.2.0 \ +crate://crates.io/security-framework/0.1.14 \ +crate://crates.io/security-framework-sys/0.1.14 \ +crate://crates.io/serde/1.0.10 \ +crate://crates.io/serde_derive/1.0.10 \ +crate://crates.io/serde_derive_internals/0.15.1 \ +crate://crates.io/serde_json/1.0.2 \ +crate://crates.io/serde_urlencoded/0.5.1 \ +crate://crates.io/sha1/0.2.0 \ +crate://crates.io/strsim/0.6.0 \ +crate://crates.io/syn/0.11.11 \ +crate://crates.io/synom/0.11.3 \ +crate://crates.io/tar/0.4.13 \ +crate://crates.io/tempdir/0.3.5 \ +crate://crates.io/term_size/0.3.0 \ +crate://crates.io/textwrap/0.6.0 \ +crate://crates.io/thread_local/0.3.4 \ +crate://crates.io/time/0.1.38 \ +crate://crates.io/toml/0.2.1 \ +crate://crates.io/toml/0.4.2 \ +crate://crates.io/traitobject/0.1.0 \ +crate://crates.io/tungstenite/0.2.4 \ +crate://crates.io/typeable/0.1.2 \ +crate://crates.io/unicase/1.4.2 \ +crate://crates.io/unicode-bidi/0.3.3 \ +crate://crates.io/unicode-normalization/0.1.5 \ +crate://crates.io/unicode-segmentation/1.1.0 \ +crate://crates.io/unicode-width/0.1.4 \ +crate://crates.io/unicode-xid/0.0.4 \ +crate://crates.io/unix_socket/0.5.0 \ +crate://crates.io/unreachable/1.0.0 \ +crate://crates.io/untrusted/0.3.2 \ +crate://crates.io/url/1.5.1 \ +crate://crates.io/utf-8/0.7.1 \ +crate://crates.io/utf8-ranges/1.0.0 \ +crate://crates.io/uuid/0.5.1 \ +crate://crates.io/vec_map/0.8.0 \ +crate://crates.io/version_check/0.1.3 \ +crate://crates.io/void/1.0.2 \ +crate://crates.io/winapi/0.2.8 \ +crate://crates.io/winapi-build/0.1.1 \ +crate://crates.io/ws2_32-sys/0.2.1 \ +crate://crates.io/xattr/0.1.11 \ +" diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb deleted file mode 100644 index 753488a..0000000 --- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb +++ /dev/null @@ -1,208 +0,0 @@ -DESCRIPTION = "sota-client rust recipe" -HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client" - -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea" - -inherit cargo systemd - -S = "${WORKDIR}/git" - -# When changing this, don't forget to: -# 1) Update PV -# 2) Check that Cargo.lock hasn't changed with git diff old..new Cargo.lock -SRCREV = "b6cf6957203fc406b3723d046f1b705e1bd08d7d" - -# Generate with: -# git describe --tags | cut -b2- -# or from the rvi_sota_client repo: -# make package-version -PV = "0.2.33-41-gb6cf695" - -BBCLASSEXTEND = "native" - -FILES_${PN} = " \ -/lib64 \ -${bindir}/sota_client \ -${bindir}/sota_sysinfo.sh \ -${bindir}/sota_provision.sh \ -${sysconfdir}/sota_client.version \ -${sysconfdir}/sota_certificates \ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \ -" - - -# list of dependencies can be generated from Cargo.lock by running -# cat Cargo.lock | sed -e '1,/metadata/ d' Cargo.lock | awk '{print "crate://crates.io/"$2 "/" $3" \\"}' -SRC_URI = " \ -crate://crates.io/advapi32-sys/0.2.0 \ -crate://crates.io/aho-corasick/0.6.3 \ -crate://crates.io/ansi_term/0.9.0 \ -crate://crates.io/antidote/1.0.0 \ -crate://crates.io/atty/0.2.2 \ -crate://crates.io/backtrace/0.3.2 \ -crate://crates.io/backtrace-sys/0.1.11 \ -crate://crates.io/base64/0.5.2 \ -crate://crates.io/bit-set/0.4.0 \ -crate://crates.io/bit-vec/0.4.4 \ -crate://crates.io/bitflags/0.9.1 \ -crate://crates.io/byteorder/1.0.0 \ -crate://crates.io/bytes/0.4.4 \ -crate://crates.io/cfg-if/0.1.2 \ -crate://crates.io/chan/0.1.19 \ -crate://crates.io/chan-signal/0.2.0 \ -crate://crates.io/chrono/0.4.0 \ -crate://crates.io/clap/2.25.0 \ -crate://crates.io/core-foundation/0.2.3 \ -crate://crates.io/core-foundation-sys/0.2.3 \ -crate://crates.io/crossbeam/0.2.10 \ -crate://crates.io/crypt32-sys/0.2.0 \ -crate://crates.io/dbghelp-sys/0.2.0 \ -crate://crates.io/dbus/0.5.3 \ -crate://crates.io/dtoa/0.4.1 \ -crate://crates.io/env_logger/0.4.3 \ -crate://crates.io/error-chain/0.10.0 \ -crate://crates.io/filetime/0.1.10 \ -crate://crates.io/foreign-types/0.2.0 \ -crate://crates.io/gcc/0.3.51 \ -crate://crates.io/getopts/0.2.14 \ -crate://crates.io/hex/0.2.0 \ -crate://crates.io/httparse/1.2.3 \ -crate://crates.io/hyper/0.10.12 \ -crate://crates.io/hyper-native-tls/0.2.4 \ -crate://crates.io/idna/0.1.2 \ -crate://crates.io/iovec/0.1.0 \ -crate://crates.io/itoa/0.3.1 \ -crate://crates.io/kernel32-sys/0.2.2 \ -crate://crates.io/language-tags/0.2.2 \ -crate://crates.io/lazy_static/0.2.8 \ -crate://crates.io/libc/0.2.24 \ -crate://crates.io/libflate/0.1.9 \ -crate://crates.io/log/0.3.8 \ -crate://crates.io/maplit/0.1.4 \ -crate://crates.io/matches/0.1.6 \ -crate://crates.io/memchr/1.0.1 \ -crate://crates.io/metadeps/1.1.2 \ -crate://crates.io/mime/0.2.6 \ -crate://crates.io/native-tls/0.1.4 \ -crate://crates.io/net2/0.2.29 \ -crate://crates.io/num/0.1.39 \ -crate://crates.io/num-integer/0.1.34 \ -crate://crates.io/num-iter/0.1.33 \ -crate://crates.io/num-traits/0.1.39 \ -crate://crates.io/num_cpus/1.6.2 \ -crate://crates.io/openssl/0.9.14 \ -crate://crates.io/openssl-sys/0.9.14 \ -crate://crates.io/pem/0.4.0 \ -crate://crates.io/percent-encoding/1.0.0 \ -crate://crates.io/pkg-config/0.3.9 \ -crate://crates.io/quote/0.3.15 \ -crate://crates.io/rand/0.3.15 \ -crate://crates.io/redox_syscall/0.1.21 \ -crate://crates.io/regex/0.2.2 \ -crate://crates.io/regex-syntax/0.4.1 \ -crate://crates.io/reqwest/0.6.2 \ -crate://crates.io/ring/0.7.1 \ -crate://crates.io/rust-crypto/0.2.36 \ -crate://crates.io/rustc-demangle/0.1.4 \ -crate://crates.io/rustc-serialize/0.3.24 \ -crate://crates.io/schannel/0.1.7 \ -crate://crates.io/secur32-sys/0.2.0 \ -crate://crates.io/security-framework/0.1.14 \ -crate://crates.io/security-framework-sys/0.1.14 \ -crate://crates.io/serde/1.0.9 \ -crate://crates.io/serde_derive/1.0.9 \ -crate://crates.io/serde_derive_internals/0.15.1 \ -crate://crates.io/serde_json/1.0.2 \ -crate://crates.io/serde_urlencoded/0.5.1 \ -crate://crates.io/sha1/0.2.0 \ -crate://crates.io/strsim/0.6.0 \ -crate://crates.io/syn/0.11.11 \ -crate://crates.io/synom/0.11.3 \ -crate://crates.io/tar/0.4.13 \ -crate://crates.io/tempdir/0.3.5 \ -crate://crates.io/term_size/0.3.0 \ -crate://crates.io/textwrap/0.6.0 \ -crate://crates.io/thread_local/0.3.4 \ -crate://crates.io/time/0.1.37 \ -crate://crates.io/toml/0.2.1 \ -crate://crates.io/toml/0.4.2 \ -crate://crates.io/traitobject/0.1.0 \ -crate://crates.io/tungstenite/0.2.4 \ -crate://crates.io/typeable/0.1.2 \ -crate://crates.io/unicase/1.4.2 \ -crate://crates.io/unicode-bidi/0.3.3 \ -crate://crates.io/unicode-normalization/0.1.5 \ -crate://crates.io/unicode-segmentation/1.1.0 \ -crate://crates.io/unicode-width/0.1.4 \ -crate://crates.io/unicode-xid/0.0.4 \ -crate://crates.io/unix_socket/0.5.0 \ -crate://crates.io/unreachable/1.0.0 \ -crate://crates.io/untrusted/0.3.2 \ -crate://crates.io/url/1.5.1 \ -crate://crates.io/utf-8/0.7.1 \ -crate://crates.io/utf8-ranges/1.0.0 \ -crate://crates.io/uuid/0.5.1 \ -crate://crates.io/vec_map/0.8.0 \ -crate://crates.io/version_check/0.1.2 \ -crate://crates.io/void/1.0.2 \ -crate://crates.io/winapi/0.2.8 \ -crate://crates.io/winapi-build/0.1.1 \ -crate://crates.io/ws2_32-sys/0.2.1 \ -crate://crates.io/xattr/0.1.11 \ -git://github.com/advancedtelematic/rvi_sota_client \ -file://sota-client-autoprovision.service \ -file://sota-client-ostree.service \ -file://sota-client-uptane.service \ -" - -SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d" -SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2" - -SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service" - -DEPENDS += " openssl openssl-native dbus " -RDEPENDS_${PN} = " libcrypto \ - libssl \ - bash \ - lshw \ - jq \ - curl \ - python \ - python-json \ - python-petname \ - " - -export SOTA_PACKED_CREDENTIALS -export SOTA_AUTOPROVISION_CREDENTIALS -export SOTA_AUTOPROVISION_URL - -do_compile_prepend() { - export SOTA_VERSION=$(make sota-version) - cd sota-client -} - -do_install() { - ln -fs /lib ${D}/lib64 - - install -d ${D}${bindir} - install -d ${D}${sysconfdir} - - echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version - install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir} - - install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} - install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir} - install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir} - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}/${systemd_unitdir}/system - if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then - install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service - else - install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service - fi - install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service - fi -} diff --git a/recipes-sota/rvi-sota-client/sota-client_git.bb b/recipes-sota/rvi-sota-client/sota-client_git.bb new file mode 100644 index 0000000..21378ce --- /dev/null +++ b/recipes-sota/rvi-sota-client/sota-client_git.bb @@ -0,0 +1,58 @@ +require rvi-sota-client.inc + + +SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service" + +FILES_${PN} = " \ +/lib64 \ +${bindir}/sota_client \ +${bindir}/sota_sysinfo.sh \ +${bindir}/sota_provision.sh \ +${sysconfdir}/sota_client.version \ +${sysconfdir}/sota_certificates \ +${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \ +${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \ +" + +DEPENDS += " openssl openssl-native dbus " +RDEPENDS_${PN} = " \ +bash \ +curl \ +libcrypto \ +libssl \ +lshw \ +jq \ +" + +export SOTA_PACKED_CREDENTIALS +export SOTA_AUTOPROVISION_CREDENTIALS +export SOTA_AUTOPROVISION_URL + +do_compile_prepend() { + export SOTA_VERSION=$(make sota-version) + cd sota-client +} + +do_install() { + ln -fs /lib ${D}/lib64 + + install -d ${D}${bindir} + install -d ${D}${sysconfdir} + + echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version + install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir} + + install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} + install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir} + install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir} + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}/${systemd_unitdir}/system + if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then + install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service + else + install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service + fi + install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service + fi +} diff --git a/recipes-sota/rvi-sota-client/sota-installer_git.bb b/recipes-sota/rvi-sota-client/sota-installer_git.bb new file mode 100644 index 0000000..338e678 --- /dev/null +++ b/recipes-sota/rvi-sota-client/sota-installer_git.bb @@ -0,0 +1,25 @@ +require rvi-sota-client.inc + + +SYSTEMD_SERVICE_${PN} = "sota-installer.service" + +DEPENDS += " sota-client " + +FILES_${PN} = " \ +${bindir}/sota-installer \ +${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-installer.service', '', d)} \ +" + +do_compile_prepend() { + cd sota-installer +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 target/${TARGET_SYS}/release/sota-installer ${D}${bindir} + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}/${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/sota-installer.service ${D}/${systemd_unitdir}/system/sota-installer.service + fi +} diff --git a/recipes-sota/rvi-sota-client/sota-launcher_git.bb b/recipes-sota/rvi-sota-client/sota-launcher_git.bb new file mode 100644 index 0000000..4104052 --- /dev/null +++ b/recipes-sota/rvi-sota-client/sota-launcher_git.bb @@ -0,0 +1,15 @@ +require rvi-sota-client.inc + + +DEPENDS += " sota-client " +FILES_${PN} = "${bindir}/sota-launcher" + + +do_compile_prepend() { + cd sota-launcher +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 target/${TARGET_SYS}/release/sota-launcher ${D}${bindir} +} -- cgit v1.2.3-54-g00ecf From 61a7adca18a1727c093e8417db8756022810d233 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Mon, 31 Jul 2017 14:56:54 +0200 Subject: Bump version of sota-tools This fixes a build error on Ubuntu. --- recipes-sota/sota-tools/sota-tools_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/sota-tools/sota-tools_git.bb b/recipes-sota/sota-tools/sota-tools_git.bb index 326ff20..2b9d0cb 100644 --- a/recipes-sota/sota-tools/sota-tools_git.bb +++ b/recipes-sota/sota-tools/sota-tools_git.bb @@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea" S = "${WORKDIR}/git" SRC_URI = "gitsm://github.com/advancedtelematic/sota-tools.git;branch=master" -SRCREV = "4d7f22f50ab43be5bee61ad3e96cd9db4ef3a372" +SRCREV = "216cb84db98e9b0f8c6c1c407f480c5dd0b3cf62" inherit cmake -- cgit v1.2.3-54-g00ecf From 25fa85e0535a4c0ea5d5dea6a7109842da8e1550 Mon Sep 17 00:00:00 2001 From: Robert Danitz Date: Mon, 31 Jul 2017 15:45:10 +0200 Subject: rename back sota-client to rvi-sota-client --- .../rvi-sota-client/rvi-sota-client_git.bb | 58 ++++++++++++++++++++++ recipes-sota/rvi-sota-client/sota-client_git.bb | 58 ---------------------- recipes-sota/rvi-sota-client/sota-installer_git.bb | 2 +- 3 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 recipes-sota/rvi-sota-client/rvi-sota-client_git.bb delete mode 100644 recipes-sota/rvi-sota-client/sota-client_git.bb diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb new file mode 100644 index 0000000..21378ce --- /dev/null +++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb @@ -0,0 +1,58 @@ +require rvi-sota-client.inc + + +SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service" + +FILES_${PN} = " \ +/lib64 \ +${bindir}/sota_client \ +${bindir}/sota_sysinfo.sh \ +${bindir}/sota_provision.sh \ +${sysconfdir}/sota_client.version \ +${sysconfdir}/sota_certificates \ +${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \ +${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \ +" + +DEPENDS += " openssl openssl-native dbus " +RDEPENDS_${PN} = " \ +bash \ +curl \ +libcrypto \ +libssl \ +lshw \ +jq \ +" + +export SOTA_PACKED_CREDENTIALS +export SOTA_AUTOPROVISION_CREDENTIALS +export SOTA_AUTOPROVISION_URL + +do_compile_prepend() { + export SOTA_VERSION=$(make sota-version) + cd sota-client +} + +do_install() { + ln -fs /lib ${D}/lib64 + + install -d ${D}${bindir} + install -d ${D}${sysconfdir} + + echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version + install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir} + + install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} + install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir} + install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir} + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}/${systemd_unitdir}/system + if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then + install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service + else + install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service + fi + install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service + fi +} diff --git a/recipes-sota/rvi-sota-client/sota-client_git.bb b/recipes-sota/rvi-sota-client/sota-client_git.bb deleted file mode 100644 index 21378ce..0000000 --- a/recipes-sota/rvi-sota-client/sota-client_git.bb +++ /dev/null @@ -1,58 +0,0 @@ -require rvi-sota-client.inc - - -SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service" - -FILES_${PN} = " \ -/lib64 \ -${bindir}/sota_client \ -${bindir}/sota_sysinfo.sh \ -${bindir}/sota_provision.sh \ -${sysconfdir}/sota_client.version \ -${sysconfdir}/sota_certificates \ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \ -" - -DEPENDS += " openssl openssl-native dbus " -RDEPENDS_${PN} = " \ -bash \ -curl \ -libcrypto \ -libssl \ -lshw \ -jq \ -" - -export SOTA_PACKED_CREDENTIALS -export SOTA_AUTOPROVISION_CREDENTIALS -export SOTA_AUTOPROVISION_URL - -do_compile_prepend() { - export SOTA_VERSION=$(make sota-version) - cd sota-client -} - -do_install() { - ln -fs /lib ${D}/lib64 - - install -d ${D}${bindir} - install -d ${D}${sysconfdir} - - echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version - install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir} - - install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} - install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir} - install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir} - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}/${systemd_unitdir}/system - if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then - install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service - else - install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service - fi - install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service - fi -} diff --git a/recipes-sota/rvi-sota-client/sota-installer_git.bb b/recipes-sota/rvi-sota-client/sota-installer_git.bb index 338e678..09f6e5d 100644 --- a/recipes-sota/rvi-sota-client/sota-installer_git.bb +++ b/recipes-sota/rvi-sota-client/sota-installer_git.bb @@ -3,7 +3,7 @@ require rvi-sota-client.inc SYSTEMD_SERVICE_${PN} = "sota-installer.service" -DEPENDS += " sota-client " +DEPENDS += " rvi-sota-client " FILES_${PN} = " \ ${bindir}/sota-installer \ -- cgit v1.2.3-54-g00ecf From a50d20b0f95c1210b4683fa2dac70b9f44941c8d Mon Sep 17 00:00:00 2001 From: Jon Oster Date: Tue, 1 Aug 2017 16:13:08 +0200 Subject: PRO-3681 Add python-petname back in rvi-sota-server RDEPENDS --- recipes-sota/rvi-sota-client/rvi-sota-client_git.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb index 21378ce..c063847 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb +++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb @@ -22,6 +22,7 @@ libcrypto \ libssl \ lshw \ jq \ +python-petname \ " export SOTA_PACKED_CREDENTIALS -- cgit v1.2.3-54-g00ecf From 245bdcdd3103ba6387655bfbd4fd4feb4e392ad0 Mon Sep 17 00:00:00 2001 From: Robert Danitz Date: Wed, 2 Aug 2017 10:27:13 +0200 Subject: update sota-client to b9170df --- recipes-sota/rvi-sota-client/rvi-sota-client.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client.inc b/recipes-sota/rvi-sota-client/rvi-sota-client.inc index 8e96a32..2a27c9a 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client.inc +++ b/recipes-sota/rvi-sota-client/rvi-sota-client.inc @@ -13,10 +13,10 @@ SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d" SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2" # also update PV and SRC_URI crates when updating SRCREV -SRCREV = "1755f1d5df05cd2924b8cf505f537f04c24f568f" +SRCREV = "b9170dfd92981505c77f8f6e51d477eb1ec57071" # generate with: `make package-version` -PV = "0.2.33-56-g1755f1d" +PV = "0.2.33-61-gb9170df" # generate with: `make yocto-version` SRC_URI = " \ -- cgit v1.2.3-54-g00ecf From 0f3f8b41b6578c97c1a3fd3b6232576757802b6b Mon Sep 17 00:00:00 2001 From: Robert Danitz Date: Wed, 2 Aug 2017 11:13:59 +0200 Subject: fix dependency of sota-launcher to correct rvi-sota-client --- recipes-sota/rvi-sota-client/rvi-sota-client_git.bb | 1 + recipes-sota/rvi-sota-client/sota-launcher_git.bb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb index c063847..7ce3ab5 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb +++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb @@ -23,6 +23,7 @@ libssl \ lshw \ jq \ python-petname \ +sota-launcher \ " export SOTA_PACKED_CREDENTIALS diff --git a/recipes-sota/rvi-sota-client/sota-launcher_git.bb b/recipes-sota/rvi-sota-client/sota-launcher_git.bb index 4104052..e9874e7 100644 --- a/recipes-sota/rvi-sota-client/sota-launcher_git.bb +++ b/recipes-sota/rvi-sota-client/sota-launcher_git.bb @@ -1,7 +1,7 @@ require rvi-sota-client.inc -DEPENDS += " sota-client " +DEPENDS += " rvi-sota-client " FILES_${PN} = "${bindir}/sota-launcher" -- cgit v1.2.3-54-g00ecf From 53307024e1845c4717be7eb8b8735e493ec4535d Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 19 Jul 2017 14:05:48 +0200 Subject: Call garage-push directly with zip file instead of sending unzipped contents. Warn if older credential environment variables are set. They are now ignored since the credentials aren't unpacked during building. --- classes/image_types_ostree.bbclass | 59 ++++++---------------- recipes-sota/aktualizr/aktualizr_git.bb | 6 +-- .../files/aktualizr-autoprovision.service | 3 +- recipes-sota/aktualizr/files/sota_autoprov.toml | 4 +- 4 files changed, 22 insertions(+), 50 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index ac7cb60..d01cb9f 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -17,36 +17,6 @@ OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" -python () { - if d.getVar("SOTA_PACKED_CREDENTIALS", True): - if d.getVar("SOTA_AUTOPROVISION_CREDENTIALS", True): - bb.warn("SOTA_AUTOPROVISION_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS") - if d.getVar("SOTA_AUTOPROVISION_URL", True): - bb.warn("SOTA_AUTOPROVISION_URL is overriden by the one in SOTA_PACKED_CREDENTIALS") - - if d.getVar("SOTA_AUTOPROVISION_URL_FILE", True): - bb.warn("SOTA_AUTOPROVISION_URL_FILE is overriden by the one in SOTA_PACKED_CREDENTIALS") - - if d.getVar("OSTREE_PUSH_CREDENTIALS", True): - bb.warn("OSTREE_PUSH_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS") - - d.setVar("SOTA_AUTOPROVISION_CREDENTIALS", "%s/sota_credentials/autoprov_credentials.p12" % d.getVar("DEPLOY_DIR_IMAGE", True)) - d.setVar("SOTA_AUTOPROVISION_URL_FILE", "%s/sota_credentials/autoprov.url" % d.getVar("DEPLOY_DIR_IMAGE", True)) - d.setVar("OSTREE_PUSH_CREDENTIALS", "%s/sota_credentials/treehub.json" % d.getVar("DEPLOY_DIR_IMAGE", True)) -} - -IMAGE_DEPENDS_ostreecredunpack = "unzip-native:do_populate_sysroot" - -IMAGE_CMD_ostreecredunpack () { - if [ ${SOTA_PACKED_CREDENTIALS} ]; then - rm -rf ${DEPLOY_DIR_IMAGE}/sota_credentials - - unzip ${SOTA_PACKED_CREDENTIALS} -d ${DEPLOY_DIR_IMAGE}/sota_credentials - fi -} - -IMAGE_TYPEDEP_ostree = "ostreecredunpack" - IMAGE_CMD_ostree () { if [ -z "$OSTREE_REPO" ]; then bbfatal "OSTREE_REPO should be set in your local.conf" @@ -145,21 +115,24 @@ IMAGE_CMD_ostree () { ln -sf var/roothome root fi - # deploy SOTA credentials mkdir -p var/sota if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then - EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="` - - if [ `date +%s` -ge `date -d "${EXPDATE}" +%s` ]; then - bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}" - fi + bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS" + fi + if [ -n "${SOTA_AUTOPROVISION_URL}" ]; then + bbwarn "SOTA_AUTOPROVISION_URL is ignored. Please use SOTA_PACKED_CREDENTIALS" + fi + if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then + bbwarn "SOTA_AUTOPROVISION_URL_FILE is ignored. Please use SOTA_PACKED_CREDENTIALS" + fi + if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then + bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS" + fi - cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12 - if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then - export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}` - fi - echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env + # deploy SOTA credentials + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then + cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip fi if [ -n "${SOTA_SECONDARY_ECUS}" ]; then @@ -207,10 +180,10 @@ IMAGE_CMD_ostree () { IMAGE_TYPEDEP_ostreepush = "ostree" IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" IMAGE_CMD_ostreepush () { - if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then garage-push --repo=${OSTREE_REPO} \ --ref=${OSTREE_BRANCHNAME} \ - --credentials=${OSTREE_PUSH_CREDENTIALS} \ + --credentials=${SOTA_PACKED_CREDENTIALS} \ --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt fi } diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 359c9fb..8bc580d 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -13,8 +13,9 @@ SRC_URI = " \ file://aktualizr-autoprovision.service \ file://sota_autoprov.toml \ " -SRCREV = "c24f1fc9b600113cf9f2d3d7215e406cbbb70ac4" +SRCREV = "1004efa3f86cef90c012b34620992b5762b741e3" PV = "1.0+git${SRCPV}" +PR = "6" S = "${WORKDIR}/git" SYSTEMD_SERVICE_${PN} = "aktualizr.service" @@ -23,11 +24,10 @@ inherit cmake systemd EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}" -export SOTA_AUTOPROVISION_CREDENTIALS export SOTA_PACKED_CREDENTIALS do_install_append() { - if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" -o -n "${SOTA_PACKED_CREDENTIALS}" ]; then + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service install -d ${D}/usr/lib/sota diff --git a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service index fd0ab09..4a595f0 100644 --- a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service +++ b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service @@ -7,8 +7,7 @@ Requires=network-online.target [Service] RestartSec=10 Restart=always -EnvironmentFile=/var/sota/sota_provisioning_url.env -ExecStart=/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --config /usr/lib/sota/sota.toml +ExecStart=/usr/bin/aktualizr --disable-keyid-validation --config /usr/lib/sota/sota.toml [Install] WantedBy=multi-user.target diff --git a/recipes-sota/aktualizr/files/sota_autoprov.toml b/recipes-sota/aktualizr/files/sota_autoprov.toml index 8799553..9d4ce3b 100644 --- a/recipes-sota/aktualizr/files/sota_autoprov.toml +++ b/recipes-sota/aktualizr/files/sota_autoprov.toml @@ -1,9 +1,9 @@ [device] packages_dir = "/tmp/packages_dir" -certificates_directory = "/var/sota" system_info = "system_info.sh" [tls] +certificates_directory = "/var/sota/" ca_file = "root.crt" client_certificate = "client.pem" pkey_file = "pkey.pem" @@ -14,5 +14,5 @@ private_key_path = "ecukey.der" public_key_path = "ecukey.pub" [provision] -p12_path = "sota_provisioning_credentials.p12" +provision_path = "/var/sota/sota_provisioning_credentials.zip" -- cgit v1.2.3-54-g00ecf From b376ae9e08c4695b95b02fbecfe55eb1bd05c603 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 20 Jul 2017 12:00:00 +0200 Subject: Minor documentation typo/grammar fix. --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index d625780..9615f65 100644 --- a/README.adoc +++ b/README.adoc @@ -115,7 +115,7 @@ ostree admin deploy --os=agl agl-snapshot:agl-ota === SOTA tools -SOTA tools now contains only one tool, garage-push that lets you push the changes in OSTree repository generated by bitbake process. It communicates with an http server capable of querying files with HEAD requests and uploading them with POST requests. In particular, this can be used with http://www.atsgarage.com/[ATS Garage]. garage-push is used as follws: +SOTA tools currently contains only one tool, garage-push, which lets you push the changes in OSTree repository generated by bitbake process. It communicates with an http server capable of querying files with HEAD requests and uploading them with POST requests. In particular, this can be used with http://www.atsgarage.com/[ATS Garage]. garage-push is used as follows: .... garage-push --repo=/path/to/ostree-repo --ref=mybranch --credentials=/path/to/credentials.json -- cgit v1.2.3-54-g00ecf From b20eb4aa872f00827d0c079d30a61bd86f68866e Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 2 Aug 2017 12:26:51 +0200 Subject: Prepare credentials correctly for rvi-sota-client. Unzip credentials archive and create files as appropriate, since none of that is necessary for aktualizr anymore. This is now done in the sota_provision script. It apparently does not work in the rvi-sota-client recipe, but this solution is perhaps even cleaner anyway. --- recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service | 1 - recipes-sota/rvi-sota-client/rvi-sota-client.inc | 5 +++-- recipes-sota/rvi-sota-client/rvi-sota-client_git.bb | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service b/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service index 0431455..11b1354 100644 --- a/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service +++ b/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service @@ -6,7 +6,6 @@ After=network-online.target [Service] Type=oneshot WorkingDirectory=/var/sota -EnvironmentFile=/var/sota/sota_provisioning_url.env Environment=SOTA_CERT_DIR=/var/sota ExecStart=/usr/bin/sota_provision.sh sota_provisioning_credentials RemainAfterExit=true diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client.inc b/recipes-sota/rvi-sota-client/rvi-sota-client.inc index 2a27c9a..00709af 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client.inc +++ b/recipes-sota/rvi-sota-client/rvi-sota-client.inc @@ -13,10 +13,11 @@ SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d" SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2" # also update PV and SRC_URI crates when updating SRCREV -SRCREV = "b9170dfd92981505c77f8f6e51d477eb1ec57071" +SRCREV = "5b335cd46c5848d8012ef03f06b50a63fdac4f7c" +PR = "1" # generate with: `make package-version` -PV = "0.2.33-61-gb9170df" +PV = "0.2.33-66-g5b335cd" # generate with: `make yocto-version` SRC_URI = " \ diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb index 7ce3ab5..e286598 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb +++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb @@ -24,11 +24,10 @@ lshw \ jq \ python-petname \ sota-launcher \ +zip \ " export SOTA_PACKED_CREDENTIALS -export SOTA_AUTOPROVISION_CREDENTIALS -export SOTA_AUTOPROVISION_URL do_compile_prepend() { export SOTA_VERSION=$(make sota-version) @@ -50,7 +49,7 @@ do_install() { if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then install -d ${D}/${systemd_unitdir}/system - if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then + if [ -n "$SOTA_PACKED_CREDENTIALS" ]; then install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service else install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service -- cgit v1.2.3-54-g00ecf From e59b7e959695a31b109b873e7de420cf947e22b8 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 8 Aug 2017 17:36:20 +0200 Subject: Remove device section as it is no longer used. --- recipes-sota/aktualizr/files/sota_autoprov.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/recipes-sota/aktualizr/files/sota_autoprov.toml b/recipes-sota/aktualizr/files/sota_autoprov.toml index 9d4ce3b..9fbb093 100644 --- a/recipes-sota/aktualizr/files/sota_autoprov.toml +++ b/recipes-sota/aktualizr/files/sota_autoprov.toml @@ -1,7 +1,3 @@ -[device] -packages_dir = "/tmp/packages_dir" -system_info = "system_info.sh" - [tls] certificates_directory = "/var/sota/" ca_file = "root.crt" -- cgit v1.2.3-54-g00ecf From 91c7c986841eb7864157c849bc47c91fd1aacf2f Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 10 Aug 2017 16:00:24 +0200 Subject: Delete treehub.json from the credentials package on the device --- classes/image_types_ostree.bbclass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index d01cb9f..6a1b33e 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -4,6 +4,7 @@ inherit image IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ openssl-native:do_populate_sysroot \ + zip-native:do_populate_sysroot \ virtual/kernel:do_deploy \ ${OSTREE_INITRAMFS_IMAGE}:do_image_complete" @@ -133,6 +134,8 @@ IMAGE_CMD_ostree () { # deploy SOTA credentials if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip + # Device should not be able to push data to treehub + zip -d var/sota/sota_provisioning_credentials.zip treehub.json fi if [ -n "${SOTA_SECONDARY_ECUS}" ]; then -- cgit v1.2.3-54-g00ecf From 88c35d35195fc4b4479c219ae1786f1541e2f42a Mon Sep 17 00:00:00 2001 From: Robert Danitz Date: Mon, 14 Aug 2017 10:21:02 +0200 Subject: update sota-client to d41540a5 --- recipes-sota/rvi-sota-client/rvi-sota-client.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client.inc b/recipes-sota/rvi-sota-client/rvi-sota-client.inc index 00709af..6718bab 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client.inc +++ b/recipes-sota/rvi-sota-client/rvi-sota-client.inc @@ -13,11 +13,12 @@ SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d" SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2" # also update PV and SRC_URI crates when updating SRCREV -SRCREV = "5b335cd46c5848d8012ef03f06b50a63fdac4f7c" +SRCREV = "d41540a54ee7bba20835b337f3a477d5f1386c76" + PR = "1" # generate with: `make package-version` -PV = "0.2.33-66-g5b335cd" +PV = "0.2.33-76-gd41540a" # generate with: `make yocto-version` SRC_URI = " \ -- cgit v1.2.3-54-g00ecf From 3ca24fcd0a49c8909c2fe50c0dcd0f8566713df9 Mon Sep 17 00:00:00 2001 From: Jan-Simon Möller Date: Mon, 14 Aug 2017 13:39:37 +0200 Subject: Set IMAGE_OVERHEAD_FACTOR for fixed initrd size Set IMAGE_OVERHEAD_FACTOR = "1.0" Otherwise the initrd was 12M due to the default overhead (x1.3). --- recipes-core/images/initramfs-ostree-image.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-core/images/initramfs-ostree-image.bb b/recipes-core/images/initramfs-ostree-image.bb index cd872b8..4870579 100644 --- a/recipes-core/images/initramfs-ostree-image.bb +++ b/recipes-core/images/initramfs-ostree-image.bb @@ -24,6 +24,7 @@ IMAGE_ROOTFS_SIZE = "8192" # Users will often ask for extra space in their rootfs by setting this # globally. Since this is a initramfs, we don't want to make it bigger IMAGE_ROOTFS_EXTRA_SPACE = "0" +IMAGE_OVERHEAD_FACTOR = "1.0" BAD_RECOMMENDATIONS += "busybox-syslog" -- cgit v1.2.3-54-g00ecf From dee9bf7a66253d782c1cb78ab57990774d00ec3e Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Thu, 17 Aug 2017 15:46:00 +0300 Subject: Show warnings if credentials are not provided Print warnings if variable SOTA_PACKED_CREDENTIALS is not set or if the specified file does not exist. Signed-off-by: Leon Anavi --- classes/image_types_ostree.bbclass | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 6a1b33e..8c9f262 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -133,9 +133,11 @@ IMAGE_CMD_ostree () { # deploy SOTA credentials if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then - cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip - # Device should not be able to push data to treehub - zip -d var/sota/sota_provisioning_credentials.zip treehub.json + if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then + cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip + # Device should not be able to push data to treehub + zip -d var/sota/sota_provisioning_credentials.zip treehub.json + fi fi if [ -n "${SOTA_SECONDARY_ECUS}" ]; then @@ -183,10 +185,17 @@ IMAGE_CMD_ostree () { IMAGE_TYPEDEP_ostreepush = "ostree" IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" IMAGE_CMD_ostreepush () { + # Print warnings if credetials are not set or if the file has not been found. if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then - garage-push --repo=${OSTREE_REPO} \ - --ref=${OSTREE_BRANCHNAME} \ - --credentials=${SOTA_PACKED_CREDENTIALS} \ - --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt + if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then + garage-push --repo=${OSTREE_REPO} \ + --ref=${OSTREE_BRANCHNAME} \ + --credentials=${SOTA_PACKED_CREDENTIALS} \ + --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt + else + bbwarn "SOTA_PACKED_CREDENTIALS file does not exist." + fi + else + bbwarn "SOTA_PACKED_CREDENTIALS not set. Please add SOTA_PACKED_CREDENTIALS." fi } -- cgit v1.2.3-54-g00ecf From b48fe3ed766250dac8564a0f6bd0b05988e35f5c Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Fri, 18 Aug 2017 14:27:37 +0300 Subject: scripts/envsetup.sh: Use machine specific local.conf Use the configurations for local.conf provided by layer meta-updater-* (depending on the machine) if variable TEMPLATECONF has not been set. Otherwise, if the variable is not set or if the layer does not provide any configurations then the default will be used (just as before this change). Signed-off-by: Leon Anavi --- scripts/envsetup.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index ff78681..260b048 100755 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh @@ -24,7 +24,15 @@ fi METADIR="${SOURCEDIR}/../.." if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then - source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" + if [ -z "$TEMPLATECONF" ] && [ -d ${METADIR}/meta-updater-${MACHINE}/conf ]; then + # Use the template configurations for the specified machine + TEMPLATECONF=${METADIR}/meta-updater-${MACHINE}/conf + source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" + unset TEMPLATECONF + else + # Use the default configurations or TEMPLATECONF set by the user + source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" + fi echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf -- cgit v1.2.3-54-g00ecf From cc8585e7864ce3731fa3db9bad2c748f7f25a6ca Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Fri, 25 Aug 2017 07:37:23 +0200 Subject: Add missing libarchive dependency --- recipes-sota/sota-tools/sota-tools_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/sota-tools/sota-tools_git.bb b/recipes-sota/sota-tools/sota-tools_git.bb index 2b9d0cb..5403d9a 100644 --- a/recipes-sota/sota-tools/sota-tools_git.bb +++ b/recipes-sota/sota-tools/sota-tools_git.bb @@ -10,7 +10,7 @@ SRCREV = "216cb84db98e9b0f8c6c1c407f480c5dd0b3cf62" inherit cmake -DEPENDS = "boost glib-2.0 curl" +DEPENDS = "boost glib-2.0 curl libarchive" BBCLASSEXTEND = "native" -- cgit v1.2.3-54-g00ecf