summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--classes/image_types_ostree.bbclass49
-rw-r--r--classes/sota.bbclass2
-rw-r--r--recipes-sota/aktualizr/aktualizr-auto-prov.bb35
-rw-r--r--recipes-sota/aktualizr/aktualizr-implicit-prov.bb2
4 files changed, 31 insertions, 57 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 26be7bf..adcafe3 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -4,11 +4,9 @@ inherit image
4 4
5IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ 5IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \
6 openssl-native:do_populate_sysroot \ 6 openssl-native:do_populate_sysroot \
7 zip-native:do_populate_sysroot \
8 coreutils-native:do_populate_sysroot \ 7 coreutils-native:do_populate_sysroot \
9 virtual/kernel:do_deploy \ 8 virtual/kernel:do_deploy \
10 ${OSTREE_INITRAMFS_IMAGE}:do_image_complete \ 9 ${OSTREE_INITRAMFS_IMAGE}:do_image_complete"
11 unzip-native"
12 10
13export OSTREE_REPO 11export OSTREE_REPO
14export OSTREE_BRANCHNAME 12export OSTREE_BRANCHNAME
@@ -20,8 +18,6 @@ OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}"
20 18
21export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" 19export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}"
22 20
23SOTA_IMPLICIT_PROV = "${@bb.utils.contains('DISTRO_FEATURES', 'implicit-prov', 'true', '', d)}"
24
25IMAGE_CMD_ostree () { 21IMAGE_CMD_ostree () {
26 if [ -z "$OSTREE_REPO" ]; then 22 if [ -z "$OSTREE_REPO" ]; then
27 bbfatal "OSTREE_REPO should be set in your local.conf" 23 bbfatal "OSTREE_REPO should be set in your local.conf"
@@ -120,53 +116,10 @@ IMAGE_CMD_ostree () {
120 ln -sf var/roothome root 116 ln -sf var/roothome root
121 fi 117 fi
122 118
123 mkdir -p var/sota
124
125 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then
126 bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS"
127 fi
128 if [ -n "${SOTA_AUTOPROVISION_URL}" ]; then
129 bbwarn "SOTA_AUTOPROVISION_URL is ignored. Please use SOTA_PACKED_CREDENTIALS"
130 fi
131 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then
132 bbwarn "SOTA_AUTOPROVISION_URL_FILE is ignored. Please use SOTA_PACKED_CREDENTIALS"
133 fi
134 if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then
135 bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS"
136 fi
137
138 # deploy SOTA credentials
139 if [ -n "${SOTA_PACKED_CREDENTIALS}" -a -z "${SOTA_IMPLICIT_PROV}" ]; then
140 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then
141 cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip
142 # Device should not be able to push data to treehub
143 zip -d var/sota/sota_provisioning_credentials.zip treehub.json
144 fi
145 fi
146
147 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then 119 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then
148 cp ${SOTA_SECONDARY_ECUS} var/sota/ecus 120 cp ${SOTA_SECONDARY_ECUS} var/sota/ecus
149 fi 121 fi
150 122
151 # Deploy client certificate and key.
152 if [ -n "${SOTA_CLIENT_CERTIFICATE}" ]; then
153 if [ -e ${SOTA_CLIENT_CERTIFICATE} ]; then
154 mkdir -p var/sota/token
155 cp ${SOTA_CLIENT_CERTIFICATE} var/sota/token/
156 fi
157 fi
158 if [ -n "${SOTA_CLIENT_KEY}" ]; then
159 if [ -e ${SOTA_CLIENT_KEY} ]; then
160 mkdir -p var/sota/token
161 cp ${SOTA_CLIENT_KEY} var/sota/token/
162 fi
163 fi
164 if [ -n "${SOTA_ROOT_CA}" ]; then
165 if [ -e ${SOTA_ROOT_CA} ]; then
166 cp ${SOTA_ROOT_CA} var/sota/
167 fi
168 fi
169
170 # Creating boot directories is required for "ostree admin deploy" 123 # Creating boot directories is required for "ostree admin deploy"
171 124
172 mkdir -p boot/loader.0 125 mkdir -p boot/loader.0
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
index 357fefd..d3b66e0 100644
--- a/classes/sota.bbclass
+++ b/classes/sota.bbclass
@@ -6,7 +6,7 @@ python __anonymous() {
6OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" 6OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}"
7 7
8SOTA_CLIENT ??= "aktualizr" 8SOTA_CLIENT ??= "aktualizr"
9SOTA_CLIENT_PROV ??= "${@bb.utils.contains('DISTRO_FEATURES', 'implicit-prov', 'aktualizr-implicit-prov', 'aktualizr-auto-prov', d)}" 9SOTA_CLIENT_PROV ??= "aktualizr-auto-prov"
10IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" 10IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}"
11IMAGE_CLASSES += " image_types_ostree image_types_ota" 11IMAGE_CLASSES += " image_types_ostree image_types_ota"
12IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" 12IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}"
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
index b30e884..48777b2 100644
--- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
@@ -4,6 +4,7 @@ HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base" 4SECTION = "base"
5LICENSE = "MPL-2.0" 5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7DEPENDS = "zip-native"
7RDEPENDS_${PN} = "aktualizr" 8RDEPENDS_${PN} = "aktualizr"
8PV = "1.0" 9PV = "1.0"
9PR = "6" 10PR = "6"
@@ -22,18 +23,40 @@ inherit systemd
22export SOTA_PACKED_CREDENTIALS 23export SOTA_PACKED_CREDENTIALS
23 24
24do_install_append() { 25do_install_append() {
26 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then
27 bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS"
28 fi
29 if [ -n "${SOTA_AUTOPROVISION_URL}" ]; then
30 bbwarn "SOTA_AUTOPROVISION_URL is ignored. Please use SOTA_PACKED_CREDENTIALS"
31 fi
32 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then
33 bbwarn "SOTA_AUTOPROVISION_URL_FILE is ignored. Please use SOTA_PACKED_CREDENTIALS"
34 fi
35 if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then
36 bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS"
37 fi
38
25 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 39 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
26 install -d ${D}/${systemd_unitdir}/system 40 install -d ${D}/${systemd_unitdir}/system
27 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service 41 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service
28 install -d ${D}/usr/lib/sota 42 install -d ${D}/usr/lib/sota
29 install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/usr/lib/sota/sota.toml 43 install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/usr/lib/sota/sota.toml
44
45 # deploy SOTA credentials
46 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then
47 mkdir -p ${D}/var/sota
48 cp ${SOTA_PACKED_CREDENTIALS} ${D}/var/sota/sota_provisioning_credentials.zip
49 # Device should not be able to push data to treehub
50 zip -d ${D}/var/sota/sota_provisioning_credentials.zip treehub.json
51 fi
30 else 52 else
31 install -d ${D}/${systemd_unitdir}/system 53 install -d ${D}/${systemd_unitdir}/system
32 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service 54 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service
33 fi 55 fi
34} 56}
35 57
36FILES_${PN} = " \ 58FILES_${PN} = " \
37 ${systemd_unitdir}/system/aktualizr.service \ 59 ${systemd_unitdir}/system/aktualizr.service \
38 /usr/lib/sota/sota.toml \ 60 /usr/lib/sota/sota.toml \
61 /var/sota/sota_provisioning_credentials.zip \
39 " 62 "
diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb
index 792d5ba..a01ef48 100644
--- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb
@@ -19,8 +19,6 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service"
19 19
20inherit systemd 20inherit systemd
21 21
22export SOTA_PACKED_CREDENTIALS
23
24do_install() { 22do_install() {
25 install -d ${D}/${systemd_unitdir}/system 23 install -d ${D}/${systemd_unitdir}/system
26 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service 24 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service