summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOYTIS <tossel@gmail.com>2017-08-10 11:37:09 +0200
committerGitHub <noreply@github.com>2017-08-10 11:37:09 +0200
commitcae622f61dae32ba5d4e96678e173afbe3637f9f (patch)
tree70c72493a81bc9a15d0433b85bc81b8bee613271
parent34d5f757a86a7e8e1db3e19f2fb33e90e3f33584 (diff)
parente59b7e959695a31b109b873e7de420cf947e22b8 (diff)
downloadmeta-updater-cae622f61dae32ba5d4e96678e173afbe3637f9f.tar.gz
Merge pull request #110 from advancedtelematic/bugfix/PRO-3484/avoid-build-unzip
Bugfix/pro 3484/avoid build unzip
-rw-r--r--README.adoc2
-rw-r--r--classes/image_types_ostree.bbclass59
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb6
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-autoprovision.service3
-rw-r--r--recipes-sota/aktualizr/files/sota_autoprov.toml8
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service1
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client.inc5
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client_git.bb5
8 files changed, 28 insertions, 61 deletions
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
115 115
116=== SOTA tools 116=== SOTA tools
117 117
118SOTA 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: 118SOTA 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:
119 119
120.... 120....
121garage-push --repo=/path/to/ostree-repo --ref=mybranch --credentials=/path/to/credentials.json 121garage-push --repo=/path/to/ostree-repo --ref=mybranch --credentials=/path/to/credentials.json
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}"
17 17
18export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" 18export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}"
19 19
20python () {
21 if d.getVar("SOTA_PACKED_CREDENTIALS", True):
22 if d.getVar("SOTA_AUTOPROVISION_CREDENTIALS", True):
23 bb.warn("SOTA_AUTOPROVISION_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS")
24 if d.getVar("SOTA_AUTOPROVISION_URL", True):
25 bb.warn("SOTA_AUTOPROVISION_URL is overriden by the one in SOTA_PACKED_CREDENTIALS")
26
27 if d.getVar("SOTA_AUTOPROVISION_URL_FILE", True):
28 bb.warn("SOTA_AUTOPROVISION_URL_FILE is overriden by the one in SOTA_PACKED_CREDENTIALS")
29
30 if d.getVar("OSTREE_PUSH_CREDENTIALS", True):
31 bb.warn("OSTREE_PUSH_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS")
32
33 d.setVar("SOTA_AUTOPROVISION_CREDENTIALS", "%s/sota_credentials/autoprov_credentials.p12" % d.getVar("DEPLOY_DIR_IMAGE", True))
34 d.setVar("SOTA_AUTOPROVISION_URL_FILE", "%s/sota_credentials/autoprov.url" % d.getVar("DEPLOY_DIR_IMAGE", True))
35 d.setVar("OSTREE_PUSH_CREDENTIALS", "%s/sota_credentials/treehub.json" % d.getVar("DEPLOY_DIR_IMAGE", True))
36}
37
38IMAGE_DEPENDS_ostreecredunpack = "unzip-native:do_populate_sysroot"
39
40IMAGE_CMD_ostreecredunpack () {
41 if [ ${SOTA_PACKED_CREDENTIALS} ]; then
42 rm -rf ${DEPLOY_DIR_IMAGE}/sota_credentials
43
44 unzip ${SOTA_PACKED_CREDENTIALS} -d ${DEPLOY_DIR_IMAGE}/sota_credentials
45 fi
46}
47
48IMAGE_TYPEDEP_ostree = "ostreecredunpack"
49
50IMAGE_CMD_ostree () { 20IMAGE_CMD_ostree () {
51 if [ -z "$OSTREE_REPO" ]; then 21 if [ -z "$OSTREE_REPO" ]; then
52 bbfatal "OSTREE_REPO should be set in your local.conf" 22 bbfatal "OSTREE_REPO should be set in your local.conf"
@@ -145,21 +115,24 @@ IMAGE_CMD_ostree () {
145 ln -sf var/roothome root 115 ln -sf var/roothome root
146 fi 116 fi
147 117
148 # deploy SOTA credentials
149 mkdir -p var/sota 118 mkdir -p var/sota
150 119
151 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then 120 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then
152 EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="` 121 bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS"
153 122 fi
154 if [ `date +%s` -ge `date -d "${EXPDATE}" +%s` ]; then 123 if [ -n "${SOTA_AUTOPROVISION_URL}" ]; then
155 bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}" 124 bbwarn "SOTA_AUTOPROVISION_URL is ignored. Please use SOTA_PACKED_CREDENTIALS"
156 fi 125 fi
126 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then
127 bbwarn "SOTA_AUTOPROVISION_URL_FILE is ignored. Please use SOTA_PACKED_CREDENTIALS"
128 fi
129 if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then
130 bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS"
131 fi
157 132
158 cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12 133 # deploy SOTA credentials
159 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then 134 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
160 export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}` 135 cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip
161 fi
162 echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env
163 fi 136 fi
164 137
165 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then 138 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then
@@ -207,10 +180,10 @@ IMAGE_CMD_ostree () {
207IMAGE_TYPEDEP_ostreepush = "ostree" 180IMAGE_TYPEDEP_ostreepush = "ostree"
208IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" 181IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot"
209IMAGE_CMD_ostreepush () { 182IMAGE_CMD_ostreepush () {
210 if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then 183 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
211 garage-push --repo=${OSTREE_REPO} \ 184 garage-push --repo=${OSTREE_REPO} \
212 --ref=${OSTREE_BRANCHNAME} \ 185 --ref=${OSTREE_BRANCHNAME} \
213 --credentials=${OSTREE_PUSH_CREDENTIALS} \ 186 --credentials=${SOTA_PACKED_CREDENTIALS} \
214 --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt 187 --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt
215 fi 188 fi
216} 189}
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 = " \
13 file://aktualizr-autoprovision.service \ 13 file://aktualizr-autoprovision.service \
14 file://sota_autoprov.toml \ 14 file://sota_autoprov.toml \
15 " 15 "
16SRCREV = "c24f1fc9b600113cf9f2d3d7215e406cbbb70ac4" 16SRCREV = "1004efa3f86cef90c012b34620992b5762b741e3"
17PV = "1.0+git${SRCPV}" 17PV = "1.0+git${SRCPV}"
18PR = "6"
18 19
19S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"
20SYSTEMD_SERVICE_${PN} = "aktualizr.service" 21SYSTEMD_SERVICE_${PN} = "aktualizr.service"
@@ -23,11 +24,10 @@ inherit cmake systemd
23 24
24EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}" 25EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}"
25 26
26export SOTA_AUTOPROVISION_CREDENTIALS
27export SOTA_PACKED_CREDENTIALS 27export SOTA_PACKED_CREDENTIALS
28 28
29do_install_append() { 29do_install_append() {
30 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" -o -n "${SOTA_PACKED_CREDENTIALS}" ]; then 30 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
31 install -d ${D}/${systemd_unitdir}/system 31 install -d ${D}/${systemd_unitdir}/system
32 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service 32 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service
33 install -d ${D}/usr/lib/sota 33 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
7[Service] 7[Service]
8RestartSec=10 8RestartSec=10
9Restart=always 9Restart=always
10EnvironmentFile=/var/sota/sota_provisioning_url.env 10ExecStart=/usr/bin/aktualizr --disable-keyid-validation --config /usr/lib/sota/sota.toml
11ExecStart=/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --config /usr/lib/sota/sota.toml
12 11
13[Install] 12[Install]
14WantedBy=multi-user.target 13WantedBy=multi-user.target
diff --git a/recipes-sota/aktualizr/files/sota_autoprov.toml b/recipes-sota/aktualizr/files/sota_autoprov.toml
index 8799553..9fbb093 100644
--- a/recipes-sota/aktualizr/files/sota_autoprov.toml
+++ b/recipes-sota/aktualizr/files/sota_autoprov.toml
@@ -1,9 +1,5 @@
1[device]
2packages_dir = "/tmp/packages_dir"
3certificates_directory = "/var/sota"
4system_info = "system_info.sh"
5
6[tls] 1[tls]
2certificates_directory = "/var/sota/"
7ca_file = "root.crt" 3ca_file = "root.crt"
8client_certificate = "client.pem" 4client_certificate = "client.pem"
9pkey_file = "pkey.pem" 5pkey_file = "pkey.pem"
@@ -14,5 +10,5 @@ private_key_path = "ecukey.der"
14public_key_path = "ecukey.pub" 10public_key_path = "ecukey.pub"
15 11
16[provision] 12[provision]
17p12_path = "sota_provisioning_credentials.p12" 13provision_path = "/var/sota/sota_provisioning_credentials.zip"
18 14
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
6[Service] 6[Service]
7Type=oneshot 7Type=oneshot
8WorkingDirectory=/var/sota 8WorkingDirectory=/var/sota
9EnvironmentFile=/var/sota/sota_provisioning_url.env
10Environment=SOTA_CERT_DIR=/var/sota 9Environment=SOTA_CERT_DIR=/var/sota
11ExecStart=/usr/bin/sota_provision.sh sota_provisioning_credentials 10ExecStart=/usr/bin/sota_provision.sh sota_provisioning_credentials
12RemainAfterExit=true 11RemainAfterExit=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"
13SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2" 13SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2"
14 14
15# also update PV and SRC_URI crates when updating SRCREV 15# also update PV and SRC_URI crates when updating SRCREV
16SRCREV = "b9170dfd92981505c77f8f6e51d477eb1ec57071" 16SRCREV = "5b335cd46c5848d8012ef03f06b50a63fdac4f7c"
17PR = "1"
17 18
18# generate with: `make package-version` 19# generate with: `make package-version`
19PV = "0.2.33-61-gb9170df" 20PV = "0.2.33-66-g5b335cd"
20 21
21# generate with: `make yocto-version` 22# generate with: `make yocto-version`
22SRC_URI = " \ 23SRC_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 \
24jq \ 24jq \
25python-petname \ 25python-petname \
26sota-launcher \ 26sota-launcher \
27zip \
27" 28"
28 29
29export SOTA_PACKED_CREDENTIALS 30export SOTA_PACKED_CREDENTIALS
30export SOTA_AUTOPROVISION_CREDENTIALS
31export SOTA_AUTOPROVISION_URL
32 31
33do_compile_prepend() { 32do_compile_prepend() {
34 export SOTA_VERSION=$(make sota-version) 33 export SOTA_VERSION=$(make sota-version)
@@ -50,7 +49,7 @@ do_install() {
50 49
51 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then 50 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
52 install -d ${D}/${systemd_unitdir}/system 51 install -d ${D}/${systemd_unitdir}/system
53 if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then 52 if [ -n "$SOTA_PACKED_CREDENTIALS" ]; then
54 install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service 53 install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service
55 else 54 else
56 install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service 55 install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service