summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaun Taheri <shaun@advancedtelematic.com>2017-07-11 17:11:11 +0200
committerRobert Danitz <robert@advancedtelematic.com>2017-07-26 11:13:10 +0200
commitff5efc4b3d11b6fabca831695337ceef50cc9255 (patch)
tree64b91fc5640ddab511c85a51a7de5407fb9d4e4d
parente5a12d4a3f06e5b85a5c3a9d2f3d3960d661f935 (diff)
downloadmeta-updater-ff5efc4b3d11b6fabca831695337ceef50cc9255.tar.gz
Split rvi-sota-client into multiple binaries
-rw-r--r--classes/image_types_ostree.bbclass6
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-installer.service12
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client.inc (renamed from recipes-sota/rvi-sota-client/rvi-sota-client_git.bb)123
-rw-r--r--recipes-sota/rvi-sota-client/sota-client_git.bb58
-rw-r--r--recipes-sota/rvi-sota-client/sota-installer_git.bb25
-rw-r--r--recipes-sota/rvi-sota-client/sota-launcher_git.bb15
6 files changed, 144 insertions, 95 deletions
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 () {
146 fi 146 fi
147 147
148 # deploy SOTA credentials 148 # deploy SOTA credentials
149 mkdir -p var/sota
150
149 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then 151 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then
150 EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="` 152 EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="`
151 153
@@ -153,7 +155,6 @@ IMAGE_CMD_ostree () {
153 bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}" 155 bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}"
154 fi 156 fi
155 157
156 mkdir -p var/sota
157 cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12 158 cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12
158 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then 159 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then
159 export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}` 160 export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}`
@@ -161,6 +162,9 @@ IMAGE_CMD_ostree () {
161 echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env 162 echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env
162 fi 163 fi
163 164
165 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then
166 cp ${SOTA_SECONDARY_ECUS} var/sota/ecus
167 fi
164 168
165 # Creating boot directories is required for "ostree admin deploy" 169 # Creating boot directories is required for "ostree admin deploy"
166 170
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 @@
1[Unit]
2Description=SOTA Secondary ECU Installer
3Requires=network-online.target
4After=network-online.target
5
6[Service]
7RestartSec=10
8Restart=always
9ExecStart=/usr/bin/sota-installer --level debug --oneshot --config /var/sota/installer.toml
10
11[Install]
12WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client.inc
index 753488a..8e96a32 100644
--- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
+++ b/recipes-sota/rvi-sota-client/rvi-sota-client.inc
@@ -1,41 +1,30 @@
1DESCRIPTION = "sota-client rust recipe" 1inherit cargo systemd
2HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client"
3 2
3DESCRIPTION = "rvi-sota-client recipe"
4HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client"
4LICENSE = "MPL-2.0" 5LICENSE = "MPL-2.0"
5LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea" 6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea"
6 7
7inherit cargo systemd 8BBCLASSEXTEND = "native"
8 9
9S = "${WORKDIR}/git" 10S = "${WORKDIR}/git"
10 11
11# When changing this, don't forget to: 12SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d"
12# 1) Update PV 13SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2"
13# 2) Check that Cargo.lock hasn't changed with git diff old..new Cargo.lock
14SRCREV = "b6cf6957203fc406b3723d046f1b705e1bd08d7d"
15
16# Generate with:
17# git describe --tags | cut -b2-
18# or from the rvi_sota_client repo:
19# make package-version
20PV = "0.2.33-41-gb6cf695"
21
22BBCLASSEXTEND = "native"
23 14
24FILES_${PN} = " \ 15# also update PV and SRC_URI crates when updating SRCREV
25/lib64 \ 16SRCREV = "1755f1d5df05cd2924b8cf505f537f04c24f568f"
26${bindir}/sota_client \
27${bindir}/sota_sysinfo.sh \
28${bindir}/sota_provision.sh \
29${sysconfdir}/sota_client.version \
30${sysconfdir}/sota_certificates \
31${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \
32${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \
33"
34 17
18# generate with: `make package-version`
19PV = "0.2.33-56-g1755f1d"
35 20
36# list of dependencies can be generated from Cargo.lock by running 21# generate with: `make yocto-version`
37# cat Cargo.lock | sed -e '1,/metadata/ d' Cargo.lock | awk '{print "crate://crates.io/"$2 "/" $3" \\"}'
38SRC_URI = " \ 22SRC_URI = " \
23git://github.com/advancedtelematic/rvi_sota_client \
24file://sota-client-autoprovision.service \
25file://sota-client-ostree.service \
26file://sota-client-uptane.service \
27file://sota-installer.service \
39crate://crates.io/advapi32-sys/0.2.0 \ 28crate://crates.io/advapi32-sys/0.2.0 \
40crate://crates.io/aho-corasick/0.6.3 \ 29crate://crates.io/aho-corasick/0.6.3 \
41crate://crates.io/ansi_term/0.9.0 \ 30crate://crates.io/ansi_term/0.9.0 \
@@ -47,7 +36,7 @@ crate://crates.io/base64/0.5.2 \
47crate://crates.io/bit-set/0.4.0 \ 36crate://crates.io/bit-set/0.4.0 \
48crate://crates.io/bit-vec/0.4.4 \ 37crate://crates.io/bit-vec/0.4.4 \
49crate://crates.io/bitflags/0.9.1 \ 38crate://crates.io/bitflags/0.9.1 \
50crate://crates.io/byteorder/1.0.0 \ 39crate://crates.io/byteorder/1.1.0 \
51crate://crates.io/bytes/0.4.4 \ 40crate://crates.io/bytes/0.4.4 \
52crate://crates.io/cfg-if/0.1.2 \ 41crate://crates.io/cfg-if/0.1.2 \
53crate://crates.io/chan/0.1.19 \ 42crate://crates.io/chan/0.1.19 \
@@ -71,14 +60,14 @@ crate://crates.io/hex/0.2.0 \
71crate://crates.io/httparse/1.2.3 \ 60crate://crates.io/httparse/1.2.3 \
72crate://crates.io/hyper/0.10.12 \ 61crate://crates.io/hyper/0.10.12 \
73crate://crates.io/hyper-native-tls/0.2.4 \ 62crate://crates.io/hyper-native-tls/0.2.4 \
74crate://crates.io/idna/0.1.2 \ 63crate://crates.io/idna/0.1.4 \
75crate://crates.io/iovec/0.1.0 \ 64crate://crates.io/iovec/0.1.0 \
76crate://crates.io/itoa/0.3.1 \ 65crate://crates.io/itoa/0.3.1 \
77crate://crates.io/kernel32-sys/0.2.2 \ 66crate://crates.io/kernel32-sys/0.2.2 \
78crate://crates.io/language-tags/0.2.2 \ 67crate://crates.io/language-tags/0.2.2 \
79crate://crates.io/lazy_static/0.2.8 \ 68crate://crates.io/lazy_static/0.2.8 \
80crate://crates.io/libc/0.2.24 \ 69crate://crates.io/libc/0.2.26 \
81crate://crates.io/libflate/0.1.9 \ 70crate://crates.io/libflate/0.1.5 \
82crate://crates.io/log/0.3.8 \ 71crate://crates.io/log/0.3.8 \
83crate://crates.io/maplit/0.1.4 \ 72crate://crates.io/maplit/0.1.4 \
84crate://crates.io/matches/0.1.6 \ 73crate://crates.io/matches/0.1.6 \
@@ -87,10 +76,10 @@ crate://crates.io/metadeps/1.1.2 \
87crate://crates.io/mime/0.2.6 \ 76crate://crates.io/mime/0.2.6 \
88crate://crates.io/native-tls/0.1.4 \ 77crate://crates.io/native-tls/0.1.4 \
89crate://crates.io/net2/0.2.29 \ 78crate://crates.io/net2/0.2.29 \
90crate://crates.io/num/0.1.39 \ 79crate://crates.io/num/0.1.40 \
91crate://crates.io/num-integer/0.1.34 \ 80crate://crates.io/num-integer/0.1.35 \
92crate://crates.io/num-iter/0.1.33 \ 81crate://crates.io/num-iter/0.1.34 \
93crate://crates.io/num-traits/0.1.39 \ 82crate://crates.io/num-traits/0.1.40 \
94crate://crates.io/num_cpus/1.6.2 \ 83crate://crates.io/num_cpus/1.6.2 \
95crate://crates.io/openssl/0.9.14 \ 84crate://crates.io/openssl/0.9.14 \
96crate://crates.io/openssl-sys/0.9.14 \ 85crate://crates.io/openssl-sys/0.9.14 \
@@ -99,7 +88,7 @@ crate://crates.io/percent-encoding/1.0.0 \
99crate://crates.io/pkg-config/0.3.9 \ 88crate://crates.io/pkg-config/0.3.9 \
100crate://crates.io/quote/0.3.15 \ 89crate://crates.io/quote/0.3.15 \
101crate://crates.io/rand/0.3.15 \ 90crate://crates.io/rand/0.3.15 \
102crate://crates.io/redox_syscall/0.1.21 \ 91crate://crates.io/redox_syscall/0.1.26 \
103crate://crates.io/regex/0.2.2 \ 92crate://crates.io/regex/0.2.2 \
104crate://crates.io/regex-syntax/0.4.1 \ 93crate://crates.io/regex-syntax/0.4.1 \
105crate://crates.io/reqwest/0.6.2 \ 94crate://crates.io/reqwest/0.6.2 \
@@ -111,8 +100,8 @@ crate://crates.io/schannel/0.1.7 \
111crate://crates.io/secur32-sys/0.2.0 \ 100crate://crates.io/secur32-sys/0.2.0 \
112crate://crates.io/security-framework/0.1.14 \ 101crate://crates.io/security-framework/0.1.14 \
113crate://crates.io/security-framework-sys/0.1.14 \ 102crate://crates.io/security-framework-sys/0.1.14 \
114crate://crates.io/serde/1.0.9 \ 103crate://crates.io/serde/1.0.10 \
115crate://crates.io/serde_derive/1.0.9 \ 104crate://crates.io/serde_derive/1.0.10 \
116crate://crates.io/serde_derive_internals/0.15.1 \ 105crate://crates.io/serde_derive_internals/0.15.1 \
117crate://crates.io/serde_json/1.0.2 \ 106crate://crates.io/serde_json/1.0.2 \
118crate://crates.io/serde_urlencoded/0.5.1 \ 107crate://crates.io/serde_urlencoded/0.5.1 \
@@ -125,7 +114,7 @@ crate://crates.io/tempdir/0.3.5 \
125crate://crates.io/term_size/0.3.0 \ 114crate://crates.io/term_size/0.3.0 \
126crate://crates.io/textwrap/0.6.0 \ 115crate://crates.io/textwrap/0.6.0 \
127crate://crates.io/thread_local/0.3.4 \ 116crate://crates.io/thread_local/0.3.4 \
128crate://crates.io/time/0.1.37 \ 117crate://crates.io/time/0.1.38 \
129crate://crates.io/toml/0.2.1 \ 118crate://crates.io/toml/0.2.1 \
130crate://crates.io/toml/0.4.2 \ 119crate://crates.io/toml/0.4.2 \
131crate://crates.io/traitobject/0.1.0 \ 120crate://crates.io/traitobject/0.1.0 \
@@ -145,64 +134,10 @@ crate://crates.io/utf-8/0.7.1 \
145crate://crates.io/utf8-ranges/1.0.0 \ 134crate://crates.io/utf8-ranges/1.0.0 \
146crate://crates.io/uuid/0.5.1 \ 135crate://crates.io/uuid/0.5.1 \
147crate://crates.io/vec_map/0.8.0 \ 136crate://crates.io/vec_map/0.8.0 \
148crate://crates.io/version_check/0.1.2 \ 137crate://crates.io/version_check/0.1.3 \
149crate://crates.io/void/1.0.2 \ 138crate://crates.io/void/1.0.2 \
150crate://crates.io/winapi/0.2.8 \ 139crate://crates.io/winapi/0.2.8 \
151crate://crates.io/winapi-build/0.1.1 \ 140crate://crates.io/winapi-build/0.1.1 \
152crate://crates.io/ws2_32-sys/0.2.1 \ 141crate://crates.io/ws2_32-sys/0.2.1 \
153crate://crates.io/xattr/0.1.11 \ 142crate://crates.io/xattr/0.1.11 \
154git://github.com/advancedtelematic/rvi_sota_client \
155file://sota-client-autoprovision.service \
156file://sota-client-ostree.service \
157file://sota-client-uptane.service \
158" 143"
159
160SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d"
161SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2"
162
163SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service"
164
165DEPENDS += " openssl openssl-native dbus "
166RDEPENDS_${PN} = " libcrypto \
167 libssl \
168 bash \
169 lshw \
170 jq \
171 curl \
172 python \
173 python-json \
174 python-petname \
175 "
176
177export SOTA_PACKED_CREDENTIALS
178export SOTA_AUTOPROVISION_CREDENTIALS
179export SOTA_AUTOPROVISION_URL
180
181do_compile_prepend() {
182 export SOTA_VERSION=$(make sota-version)
183 cd sota-client
184}
185
186do_install() {
187 ln -fs /lib ${D}/lib64
188
189 install -d ${D}${bindir}
190 install -d ${D}${sysconfdir}
191
192 echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version
193 install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir}
194
195 install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir}
196 install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir}
197 install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir}
198
199 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
200 install -d ${D}/${systemd_unitdir}/system
201 if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then
202 install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service
203 else
204 install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service
205 fi
206 install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service
207 fi
208}
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 @@
1require rvi-sota-client.inc
2
3
4SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service"
5
6FILES_${PN} = " \
7/lib64 \
8${bindir}/sota_client \
9${bindir}/sota_sysinfo.sh \
10${bindir}/sota_provision.sh \
11${sysconfdir}/sota_client.version \
12${sysconfdir}/sota_certificates \
13${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \
14${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \
15"
16
17DEPENDS += " openssl openssl-native dbus "
18RDEPENDS_${PN} = " \
19bash \
20curl \
21libcrypto \
22libssl \
23lshw \
24jq \
25"
26
27export SOTA_PACKED_CREDENTIALS
28export SOTA_AUTOPROVISION_CREDENTIALS
29export SOTA_AUTOPROVISION_URL
30
31do_compile_prepend() {
32 export SOTA_VERSION=$(make sota-version)
33 cd sota-client
34}
35
36do_install() {
37 ln -fs /lib ${D}/lib64
38
39 install -d ${D}${bindir}
40 install -d ${D}${sysconfdir}
41
42 echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version
43 install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir}
44
45 install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir}
46 install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir}
47 install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir}
48
49 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
50 install -d ${D}/${systemd_unitdir}/system
51 if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then
52 install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service
53 else
54 install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service
55 fi
56 install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service
57 fi
58}
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 @@
1require rvi-sota-client.inc
2
3
4SYSTEMD_SERVICE_${PN} = "sota-installer.service"
5
6DEPENDS += " sota-client "
7
8FILES_${PN} = " \
9${bindir}/sota-installer \
10${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-installer.service', '', d)} \
11"
12
13do_compile_prepend() {
14 cd sota-installer
15}
16
17do_install() {
18 install -d ${D}${bindir}
19 install -m 0755 target/${TARGET_SYS}/release/sota-installer ${D}${bindir}
20
21 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
22 install -d ${D}/${systemd_unitdir}/system
23 install -m 0644 ${WORKDIR}/sota-installer.service ${D}/${systemd_unitdir}/system/sota-installer.service
24 fi
25}
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 @@
1require rvi-sota-client.inc
2
3
4DEPENDS += " sota-client "
5FILES_${PN} = "${bindir}/sota-launcher"
6
7
8do_compile_prepend() {
9 cd sota-launcher
10}
11
12do_install() {
13 install -d ${D}${bindir}
14 install -m 0755 target/${TARGET_SYS}/release/sota-launcher ${D}${bindir}
15}