Browse Source

feat: Install a bootstrap Artifact in /data/mender/bootstrap.mender

Changelog: A bootstrap Artifact is now installed in
/data/mender/bootstrap.mender, on every conversion, adding the ability to have
the Mender client bootstrap the database without running an update first, thus
enabling delta-updates to be installed without first running a full rootfs
update. Please note that this will require a minimum of the Mender client at
version 3.4.x. However, the generated Artifact is still usable in any case.

Ticket: MEN-5594

Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
4.0.x
Ole Petter 3 years ago
parent
commit
7e5b119696
No known key found for this signature in database GPG Key ID: 399DBE0F4D4B02EB
  1. 5
      mender-convert-modify
  2. 25
      mender-convert-package

5
mender-convert-modify

@ -213,11 +213,6 @@ fi
run_and_log_cmd "echo 'device_type=${device_type}' > work/device_type"
run_and_log_cmd "sudo install -m 0444 work/device_type work/rootfs/data/mender/"
if [ "${MENDER_CLIENT_INSTALL}" = "y" ]; then
run_and_log_cmd "echo 'artifact_name=${MENDER_ARTIFACT_NAME}' \
| sudo tee work/rootfs/etc/mender/artifact_info"
fi
log_info "Creating state scripts version file."
case "${MENDER_CLIENT_VERSION}" in
1*) VERSION_STRING='2' ;;

25
mender-convert-package

@ -199,11 +199,10 @@ else
log_fatal "Could not determine root file-system type. Aborting..."
fi
disk_create_file_system_from_folder "work/rootfs/data/" "work/data.img" \
"${data_part_sectors}" "${image_fs_type}"
# Clear this area as it will be contained in the data.img
sudo rm -rf work/rootfs/data/*
# NOTE: Since the data partition has a dependency on the rootfs.img checksum
# when writing the bootstrap Artifact we have to move the datadir out of the
# way, and write the rootfs image first.
run_and_log_cmd "mv --force work/rootfs/data work/data"
disk_create_file_system_from_folder "work/rootfs/" "work/rootfs.img" \
"${rootfs_image_sectors}" "${image_fs_type}"
@ -211,6 +210,22 @@ disk_create_file_system_from_folder "work/rootfs/" "work/rootfs.img" \
log_info "Copying root filesystem image to deploy directory"
run_and_log_cmd "cp --sparse=always work/rootfs.img deploy/${image_name}.${image_fs_type}"
# Add the bootstrap Artifact to the data.img before packaging
# the data image
log_info "Installing the bootstrap Artifact"
rootfs_img_checksum=$(sha256sum work/rootfs.img | cut -d ' ' -f1)
run_and_log_cmd "mender-artifact write bootstrap-artifact \
--artifact-name "${MENDER_ARTIFACT_NAME}" \
--no-progress \
--device-type "${device_type}" \
--provides rootfs-image.version:"${MENDER_ARTIFACT_NAME}" \
--provides rootfs-image.checksum:${rootfs_img_checksum} \
--output-path work/data/mender/bootstrap.mender"
disk_create_file_system_from_folder "work/data/" "work/data.img" \
"${data_part_sectors}" "${image_fs_type}"
run_and_log_cmd "rm -rf work/data"
if [ "${MENDER_CLIENT_INSTALL}" != "y" ]; then
log_warn "Generating Artifact with no Mender client in it; not suitable for deployment"
fi

Loading…
Cancel
Save