summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2020-04-28 18:54:39 +0000
committerStefan Agner <stefan.agner@toradex.com>2020-05-07 21:06:55 +0000
commit48c0442f926940346e2d4fa693c49cb7419917bf (patch)
treecdd2b2c827647b5e2f304e4399305d395d3378d3
parentfcc397f16efde0c053c8a96e7500147ab84cb8d3 (diff)
downloadmeta-updater-48c0442f926940346e2d4fa693c49cb7419917bf.tar.gz
image_types_ota: use named reference
Use named reference when deploying the device tree. This makes sure that this reference will end up in the deployments .origin file, which will be visible by the user in ostree admin status. This reference will also be used when running ostree admin upgrade. This is not really required when using aktualizr, but can be useful during test/debugging when using pure OSTree updates. Make sure to make ${OSTREE_REPO} accessible via http and add a remote on the device called ${OSTREE_OSNAME} pointing to the http exposed archive OSTree. With that ostree admin upgrade should work. Note: We could use the name reference in ostree pull-local already, but this is potentially racy if multiple builds are committing to the same branch. Use the OSTree commit hash to get the actual commit and recreate a local reference to this commit. This makes absolutely sure that we use the same OSTree commit this bitbake execution committed during the do_image_ostreecommit task. Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r--classes/image_types_ota.bbclass12
1 files changed, 11 insertions, 1 deletions
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass
index 56c7794..a8a19b5 100644
--- a/classes/image_types_ota.bbclass
+++ b/classes/image_types_ota.bbclass
@@ -66,13 +66,23 @@ IMAGE_CMD_ota () {
66 66
67 ostree_target_hash=$(cat ${WORKDIR}/ostree_manifest) 67 ostree_target_hash=$(cat ${WORKDIR}/ostree_manifest)
68 68
69 # Use OSTree hash to avoid any potential race conditions between
70 # multiple builds accessing the same ${OSTREE_REPO}.
69 ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} 71 ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash}
70 kargs_list="" 72 kargs_list=""
71 for arg in ${OSTREE_KERNEL_ARGS}; do 73 for arg in ${OSTREE_KERNEL_ARGS}; do
72 kargs_list="${kargs_list} --karg-append=$arg" 74 kargs_list="${kargs_list} --karg-append=$arg"
73 done 75 done
74 76
75 ostree admin --sysroot=${OTA_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${ostree_target_hash} 77 # Create the same reference on the device we use in the archive OSTree
78 # repo in ${OSTREE_REPO}. This reference will show up when showing the
79 # deployment on the device:
80 # ostree admin status
81 # If a remote with the name ${OSTREE_OSNAME} is configured, this also
82 # will allow to use:
83 # ostree admin upgrade
84 ostree --repo=${OTA_SYSROOT}/ostree/repo refs --create=${OSTREE_OSNAME}:${OSTREE_BRANCHNAME} ${ostree_target_hash}
85 ostree admin --sysroot=${OTA_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME}
76 86
77 cp -a ${IMAGE_ROOTFS}/var/sota ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true 87 cp -a ${IMAGE_ROOTFS}/var/sota ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true
78 # Create /var/sota if it doesn't exist yet 88 # Create /var/sota if it doesn't exist yet