diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2018-03-29 13:45:30 +0200 |
---|---|---|
committer | Patrick Vacek <patrickvacek@gmail.com> | 2018-05-28 11:10:57 +0200 |
commit | 4b33b1ac46fb525941c588b0a4c1b3ce132cad71 (patch) | |
tree | 244af48911d34ebc10ff12c35d1f107755666393 | |
parent | 4bcd0509c780a2e244aab4713926a548c176fb5f (diff) | |
download | meta-updater-bugfix/PRO-5140/hardware_ids.tar.gz |
Try to set hardware IDs in local.conf.bugfix/PRO-5140/hardware_ids
Communicating the IDs to the images works, but getting the IDs in the
garage-push commits does not. I can get the variables exported, but the
script still uses the wrong (old) value. Not sure why.
-rw-r--r-- | classes/image_types_ostree.bbclass | 3 | ||||
-rw-r--r-- | classes/sota.bbclass | 2 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr-secondary-conf.bb | 28 | ||||
-rw-r--r-- | recipes-sota/aktualizr/environment-secondary.inc | 12 | ||||
-rw-r--r-- | recipes-sota/aktualizr/environment.inc | 7 | ||||
-rw-r--r-- | recipes-sota/aktualizr/files/aktualizr-secondary.service | 3 | ||||
-rw-r--r-- | recipes-test/images/primary-image.bb | 8 | ||||
-rw-r--r-- | recipes-test/images/secondary-image.bb | 14 |
8 files changed, 74 insertions, 3 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index bc44e33..1313c40 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -10,6 +10,7 @@ do_image_ostree[depends] += "ostree-native:do_populate_sysroot \ | |||
10 | export OSTREE_REPO | 10 | export OSTREE_REPO |
11 | export OSTREE_BRANCHNAME | 11 | export OSTREE_BRANCHNAME |
12 | export GARAGE_TARGET_NAME | 12 | export GARAGE_TARGET_NAME |
13 | export SOTA_HARDWARE_ID | ||
13 | 14 | ||
14 | RAMDISK_EXT ?= ".${OSTREE_INITRAMFS_FSTYPES}" | 15 | RAMDISK_EXT ?= ".${OSTREE_INITRAMFS_FSTYPES}" |
15 | 16 | ||
@@ -220,7 +221,7 @@ IMAGE_CMD_garagesign () { | |||
220 | --length 0 \ | 221 | --length 0 \ |
221 | --url "${GARAGE_TARGET_URL}" \ | 222 | --url "${GARAGE_TARGET_URL}" \ |
222 | --sha256 ${ostree_target_hash} \ | 223 | --sha256 ${ostree_target_hash} \ |
223 | --hardwareids ${MACHINE} | 224 | --hardwareids ${SOTA_HARDWARE_ID} |
224 | garage-sign targets sign --repo tufrepo \ | 225 | garage-sign targets sign --repo tufrepo \ |
225 | --home-dir ${GARAGE_SIGN_REPO} \ | 226 | --home-dir ${GARAGE_SIGN_REPO} \ |
226 | --key-name=targets | 227 | --key-name=targets |
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 38d4ce5..d9df83a 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
@@ -36,6 +36,8 @@ GARAGE_TARGET_NAME ?= "${OSTREE_BRANCHNAME}" | |||
36 | GARAGE_TARGET_VERSION ?= "" | 36 | GARAGE_TARGET_VERSION ?= "" |
37 | GARAGE_TARGET_URL ?= "https://example.com/" | 37 | GARAGE_TARGET_URL ?= "https://example.com/" |
38 | 38 | ||
39 | SOTA_HARDWARE_ID ?= "${MACHINE}" | ||
40 | |||
39 | SOTA_MACHINE ??="none" | 41 | SOTA_MACHINE ??="none" |
40 | SOTA_MACHINE_rpi ?= "raspberrypi" | 42 | SOTA_MACHINE_rpi ?= "raspberrypi" |
41 | SOTA_MACHINE_porter ?= "porter" | 43 | SOTA_MACHINE_porter ?= "porter" |
diff --git a/recipes-sota/aktualizr/aktualizr-secondary-conf.bb b/recipes-sota/aktualizr/aktualizr-secondary-conf.bb new file mode 100644 index 0000000..c13bf94 --- /dev/null +++ b/recipes-sota/aktualizr/aktualizr-secondary-conf.bb | |||
@@ -0,0 +1,28 @@ | |||
1 | SUMMARY = "Aktualizr secondary configuration" | ||
2 | DESCRIPTION = "Systemd service and configurations for Aktualizr secondaries" | ||
3 | HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" | ||
4 | SECTION = "base" | ||
5 | LICENSE = "MPL-2.0" | ||
6 | LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" | ||
7 | RDEPENDS_${PN} = "aktualizr-secondary" | ||
8 | PV = "1.0" | ||
9 | |||
10 | SRC_URI = " \ | ||
11 | file://LICENSE \ | ||
12 | " | ||
13 | |||
14 | export SOTA_SECONDARY_HARDWARE_ID | ||
15 | |||
16 | do_install() { | ||
17 | AKTUALIZR_PARAMETERS_CONFIGFILE="--config /usr/lib/sota/sota_secondary.toml" | ||
18 | if [ -n "${SOTA_SECONDARY_HARDWARE_ID}" ]; then | ||
19 | AKTUALIZR_PARAMETERS_HARDWARE_ID="--ecu-hardware-id ${SOTA_SECONDARY_HARDWARE_ID}"; | ||
20 | fi | ||
21 | |||
22 | install -d ${D}${libdir}/sota | ||
23 | echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_CONFIGFILE} ${AKTUALIZR_PARAMETERS_HARDWARE_ID}" > ${D}${libdir}/sota/sota.env | ||
24 | } | ||
25 | |||
26 | FILES_${PN} = "${libdir}/sota/sota.env" | ||
27 | |||
28 | # vim:set ts=4 sw=4 sts=4 expandtab: | ||
diff --git a/recipes-sota/aktualizr/environment-secondary.inc b/recipes-sota/aktualizr/environment-secondary.inc new file mode 100644 index 0000000..18a4684 --- /dev/null +++ b/recipes-sota/aktualizr/environment-secondary.inc | |||
@@ -0,0 +1,12 @@ | |||
1 | export SOTA_SECONDARY_HARDWARE_ID | ||
2 | |||
3 | do_install_append() { | ||
4 | AKTUALIZR_PARAMETERS_CONFIGFILE="--config /usr/lib/sota/sota_secondary.toml" | ||
5 | if [ -n "${SOTA_PRIMARY_HARDWARE_ID}" ]; then | ||
6 | AKTUALIZR_PARAMETERS_HARDWARE_ID="--ecu-hardware-id ${SOTA_PRIMARY_HARDWARE_ID}" | ||
7 | fi | ||
8 | |||
9 | echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_CONFIGFILE} ${AKTUALIZR_PARAMETERS_HARDWARE_ID}" > ${D}${libdir}/sota/sota.env | ||
10 | } | ||
11 | |||
12 | FILES_${PN}_append = " ${libdir}/sota/sota.env" | ||
diff --git a/recipes-sota/aktualizr/environment.inc b/recipes-sota/aktualizr/environment.inc index 16e789e..73517b0 100644 --- a/recipes-sota/aktualizr/environment.inc +++ b/recipes-sota/aktualizr/environment.inc | |||
@@ -1,11 +1,16 @@ | |||
1 | export SOTA_VIRTUAL_SECONDARIES | 1 | export SOTA_VIRTUAL_SECONDARIES |
2 | export SOTA_PRIMARY_HARDWARE_ID | ||
2 | 3 | ||
3 | do_install_append() { | 4 | do_install_append() { |
4 | for sec in ${SOTA_VIRTUAL_SECONDARIES}; do | 5 | for sec in ${SOTA_VIRTUAL_SECONDARIES}; do |
5 | AKTUALIZR_PARAMETERS_VIRTUALSECS="${AKTUALIZR_PARAMETERS_VIRTUALSECS} --secondary-config $sec" | 6 | AKTUALIZR_PARAMETERS_VIRTUALSECS="${AKTUALIZR_PARAMETERS_VIRTUALSECS} --secondary-config $sec" |
6 | done | 7 | done |
7 | 8 | ||
8 | echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_VIRTUALSECS}" > ${D}${libdir}/sota/sota.env | 9 | if [ -n "${SOTA_PRIMARY_HARDWARE_ID}" ]; then |
10 | AKTUALIZR_PARAMETERS_HARDWARE_ID="--primary-ecu-hardware-id ${SOTA_PRIMARY_HARDWARE_ID}" | ||
11 | fi | ||
12 | |||
13 | echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_VIRTUALSECS} ${AKTUALIZR_PARAMETERS_HARDWARE_ID}" > ${D}${libdir}/sota/sota.env | ||
9 | } | 14 | } |
10 | 15 | ||
11 | FILES_${PN}_append = " ${libdir}/sota/sota.env" | 16 | FILES_${PN}_append = " ${libdir}/sota/sota.env" |
diff --git a/recipes-sota/aktualizr/files/aktualizr-secondary.service b/recipes-sota/aktualizr/files/aktualizr-secondary.service index a1e0e1b..5173ae9 100644 --- a/recipes-sota/aktualizr/files/aktualizr-secondary.service +++ b/recipes-sota/aktualizr/files/aktualizr-secondary.service | |||
@@ -4,6 +4,7 @@ Description=Aktualizr SOTA Client (UPTANE Secondary) | |||
4 | [Service] | 4 | [Service] |
5 | RestartSec=10 | 5 | RestartSec=10 |
6 | Restart=always | 6 | Restart=always |
7 | EnvironmentFile=/usr/lib/sota/sota.env | ||
7 | EnvironmentFile=-/etc/sota/sota.env | 8 | EnvironmentFile=-/etc/sota/sota.env |
8 | ExecStart=/usr/bin/aktualizr-secondary --config /usr/lib/sota/sota_secondary.toml | 9 | ExecStart=/usr/bin/aktualizr-secondary $AKTUALIZR_CMDLINE_PARAMETERS |
9 | 10 | ||
diff --git a/recipes-test/images/primary-image.bb b/recipes-test/images/primary-image.bb index 6d2df94..21ff565 100644 --- a/recipes-test/images/primary-image.bb +++ b/recipes-test/images/primary-image.bb | |||
@@ -1,9 +1,17 @@ | |||
1 | include recipes-core/images/core-image-minimal.bb | 1 | include recipes-core/images/core-image-minimal.bb |
2 | 2 | ||
3 | #export SOTA_PRIMARY_HARDWARE_ID | ||
4 | #export SOTA_HARDWARE_ID | ||
5 | |||
3 | SUMMARY = "A minimal Uptane Primary image running aktualizr, for testing with a Linux secondary" | 6 | SUMMARY = "A minimal Uptane Primary image running aktualizr, for testing with a Linux secondary" |
4 | 7 | ||
5 | LICENSE = "MIT" | 8 | LICENSE = "MIT" |
6 | 9 | ||
10 | python () { | ||
11 | if d.getVar("SOTA_PRIMARY_HARDWARE_ID", True): | ||
12 | d.setVar("SOTA_HARDWARE_ID", d.getVar("SOTA_PRIMARY_HARDWARE_ID", True)) | ||
13 | } | ||
14 | |||
7 | IMAGE_INSTALL_remove = " \ | 15 | IMAGE_INSTALL_remove = " \ |
8 | " | 16 | " |
9 | 17 | ||
diff --git a/recipes-test/images/secondary-image.bb b/recipes-test/images/secondary-image.bb index 9adbdc5..75deb5a 100644 --- a/recipes-test/images/secondary-image.bb +++ b/recipes-test/images/secondary-image.bb | |||
@@ -1,9 +1,22 @@ | |||
1 | include recipes-core/images/core-image-minimal.bb | 1 | include recipes-core/images/core-image-minimal.bb |
2 | 2 | ||
3 | export SOTA_SECONDARY_HARDWARE_ID | ||
4 | export SOTA_HARDWARE_ID | ||
5 | |||
3 | SUMMARY = "A minimal Uptane Secondary image running aktualizr-secondary" | 6 | SUMMARY = "A minimal Uptane Secondary image running aktualizr-secondary" |
4 | 7 | ||
5 | LICENSE = "MIT" | 8 | LICENSE = "MIT" |
6 | 9 | ||
10 | IMAGE_TYPEDEP_garagesign_append = " set_hardware_id " | ||
11 | IMAGE_CMD_set_hardware_id() { | ||
12 | if [ -n "${SOTA_SECONDARY_HARDWARE_ID}" ]; then | ||
13 | SOTA_HARDWARE_ID="${SOTA_SECONDARY_HARDWARE_ID}" | ||
14 | fi | ||
15 | } | ||
16 | #python IMAGE_CMD_set_hardware_id() { | ||
17 | # if d.getVar("SOTA_SECONDARY_HARDWARE_ID", True): | ||
18 | # d.setVar("SOTA_HARDWARE_ID", d.getVar("SOTA_SECONDARY_HARDWARE_ID", True)) | ||
19 | #} | ||
7 | 20 | ||
8 | # Remove default aktualizr primary, and the provisioning configuration (which | 21 | # Remove default aktualizr primary, and the provisioning configuration (which |
9 | # RDEPENDS on aktualizr) | 22 | # RDEPENDS on aktualizr) |
@@ -19,6 +32,7 @@ IMAGE_INSTALL_remove = " \ | |||
19 | 32 | ||
20 | IMAGE_INSTALL_append = " \ | 33 | IMAGE_INSTALL_append = " \ |
21 | aktualizr-secondary \ | 34 | aktualizr-secondary \ |
35 | aktualizr-secondary-conf \ | ||
22 | secondary-network-config \ | 36 | secondary-network-config \ |
23 | " | 37 | " |
24 | 38 | ||