From 907e752c44934da14863590b8ca0728f3ed7de52 Mon Sep 17 00:00:00 2001 From: Drew Moseley Date: Fri, 5 Jun 2020 12:27:37 -0400 Subject: [PATCH] Unmount filesystem images before creating full image. This results in filesystems with fewer fsck failures in some environments. Changelog: Title Signed-off-by: Drew Moseley (cherry picked from commit 49be51121630640ca6ca2e218e1ff453a86b467e) --- mender-convert-package | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mender-convert-package b/mender-convert-package index 025394b..0098497 100755 --- a/mender-convert-package +++ b/mender-convert-package @@ -23,8 +23,8 @@ PLATFORM_PACKAGE_HOOKS=(platform_package) function trap_exit() { echo "mender-convert-package has finished. Cleaning up..." - sudo umount -f work/boot > /dev/null - sudo umount -f work/rootfs > /dev/null + sudo umount -f work/boot > /dev/null 2>&1 || true + sudo umount -f work/rootfs > /dev/null 2>&1 || true } function trap_term() { @@ -255,6 +255,10 @@ if [ "${MENDER_COPY_BOOT_GAP}" == "y" ]; then disk_write_at_offset "${output_dir}/boot-gap.bin" "${img_path}" "1" fi +# Unmount filesystem image files +run_and_log_cmd "sudo umount -f work/boot" +run_and_log_cmd "sudo umount -f work/rootfs" + # Burn Partitions log_info "Writing boot partition image" disk_write_at_offset "${boot_part}" "${img_path}" "${boot_part_start}"