summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2017-10-05 14:18:06 +0200
committerPatrick Vacek <patrickvacek@gmail.com>2017-10-05 15:05:00 +0200
commit098f69acc074d1905cb3e9aa6374fec427a63df7 (patch)
tree4727b2811be48cc7ba5412ced15f88ea3165802f /classes
parent672706273326597ed942b9a8d05e9ca315cc6130 (diff)
downloadmeta-updater-098f69acc074d1905cb3e9aa6374fec427a63df7.tar.gz
Move provisioning out of ostree bbclass into autoprov recipe.
Also remove implicit-prov from DISTRO_FEATURES. Just specify SOTA_CLIENT_PROV directly.
Diffstat (limited to 'classes')
-rw-r--r--classes/image_types_ostree.bbclass49
-rw-r--r--classes/sota.bbclass2
2 files changed, 2 insertions, 49 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)}"