From afb1b23bdd834b7d35135c00b35c17f868d6568a Mon Sep 17 00:00:00 2001 From: Simon Ensslen Date: Mon, 31 Jan 2022 15:56:16 +0100 Subject: [PATCH] modify fstab instead of replacing in order to keep modifications made Changelog: The fstab file from the image being converted is now preserved across convertions, with the Mender specific additions merged with the existing fstab file, as opposed to replacing it completely. Which was the previous approach. Signed-off-by: Simon Ensslen --- configs/mender_convert_config | 3 +++ mender-convert-modify | 13 ++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/configs/mender_convert_config b/configs/mender_convert_config index 4357caf..f524258 100644 --- a/configs/mender_convert_config +++ b/configs/mender_convert_config @@ -32,6 +32,9 @@ MENDER_ARTIFACT_COMPRESSION="gzip" # this. MENDER_ENABLE_SYSTEMD=y +# Set the fstab options for mounting the boot partition +MENDER_BOOT_PART_FSTAB_OPTS="defaults,sync" + # Custom mkfs options for creating the rootfs partition MENDER_ROOT_PART_MKFS_OPTS="" diff --git a/mender-convert-modify b/mender-convert-modify index 2d876ce..1a1f7a4 100755 --- a/mender-convert-modify +++ b/mender-convert-modify @@ -356,14 +356,17 @@ fi log_info "Using boot partition device in fstab: $boot_part_device" log_info "Using data partition device in fstab: $data_part_device" -sudo bash -c "cat <<- EOF > work/rootfs/etc/fstab -# stock fstab - you probably want to override this with a machine specific one +fstab=$(sed '/\/boot/d' work/rootfs/etc/fstab) +fstab=$(sed '/.*\s\/\s.*/d' <<< "$fstab") +cat <<- EOF > work/rootfs/etc/fstab +${boot_part_device} ${boot_part_mountpoint} auto ${MENDER_BOOT_PART_FSTAB_OPTS} 0 0 /dev/root / auto ${MENDER_ROOT_PART_FSTAB_OPTS} 1 ${MENDER_ROOT_PART_FS_PASSNO} -proc /proc proc defaults 0 0 -${boot_part_device} ${boot_part_mountpoint} auto defaults,sync 0 0 ${data_part_device} /data auto ${MENDER_DATA_PART_FSTAB_OPTS} 0 0 -EOF" + +# entries kept from original fstab +$fstab +EOF # # Make sure to re-label rootfs when selinux is in enforcing mode