diff --git a/mender-convert-modify b/mender-convert-modify index a777609..68e95d3 100755 --- a/mender-convert-modify +++ b/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' ;; diff --git a/mender-convert-package b/mender-convert-package index b9ab77b..7171443 100755 --- a/mender-convert-package +++ b/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