diff options
-rw-r--r-- | classes/image_types_ostree.bbclass | 49 | ||||
-rw-r--r-- | classes/sota.bbclass | 2 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr-auto-prov.bb | 35 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 2 |
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 | ||
5 | IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ | 5 | IMAGE_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 | ||
13 | export OSTREE_REPO | 11 | export OSTREE_REPO |
14 | export OSTREE_BRANCHNAME | 12 | export OSTREE_BRANCHNAME |
@@ -20,8 +18,6 @@ OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" | |||
20 | 18 | ||
21 | export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" | 19 | export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" |
22 | 20 | ||
23 | SOTA_IMPLICIT_PROV = "${@bb.utils.contains('DISTRO_FEATURES', 'implicit-prov', 'true', '', d)}" | ||
24 | |||
25 | IMAGE_CMD_ostree () { | 21 | IMAGE_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() { | |||
6 | OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" | 6 | OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" |
7 | 7 | ||
8 | SOTA_CLIENT ??= "aktualizr" | 8 | SOTA_CLIENT ??= "aktualizr" |
9 | SOTA_CLIENT_PROV ??= "${@bb.utils.contains('DISTRO_FEATURES', 'implicit-prov', 'aktualizr-implicit-prov', 'aktualizr-auto-prov', d)}" | 9 | SOTA_CLIENT_PROV ??= "aktualizr-auto-prov" |
10 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" | 10 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" |
11 | IMAGE_CLASSES += " image_types_ostree image_types_ota" | 11 | IMAGE_CLASSES += " image_types_ostree image_types_ota" |
12 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" | 12 | IMAGE_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" | |||
4 | SECTION = "base" | 4 | SECTION = "base" |
5 | LICENSE = "MPL-2.0" | 5 | LICENSE = "MPL-2.0" |
6 | LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" | 6 | LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" |
7 | DEPENDS = "zip-native" | ||
7 | RDEPENDS_${PN} = "aktualizr" | 8 | RDEPENDS_${PN} = "aktualizr" |
8 | PV = "1.0" | 9 | PV = "1.0" |
9 | PR = "6" | 10 | PR = "6" |
@@ -22,18 +23,40 @@ inherit systemd | |||
22 | export SOTA_PACKED_CREDENTIALS | 23 | export SOTA_PACKED_CREDENTIALS |
23 | 24 | ||
24 | do_install_append() { | 25 | do_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 | ||
36 | FILES_${PN} = " \ | 58 | FILES_${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 | ||
20 | inherit systemd | 20 | inherit systemd |
21 | 21 | ||
22 | export SOTA_PACKED_CREDENTIALS | ||
23 | |||
24 | do_install() { | 22 | do_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 |