This patch extends the imager direct class to check if the mountpoint of a to-be-added entry in the fstab is already there. If it is, the old entry is removed and the new entry is appended.
This solves issues with duplicated entries that come from the rootfs itself. One example where this happens is when generating images for both direct kernel boot and EFI. In this case, the rootfs mountpoint needs to be in the fstab of the rootfs and needs to be replaced in WIC. With this logic, the reverted commit 20d43a2 can be included again. Reviewed-by: Florian Bezdeka <[email protected]> Signed-off-by: Felix Moessbauer <[email protected]> --- scripts/lib/wic/plugins/imager/direct.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index dfaa901567..085bf8b463 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -104,6 +104,14 @@ class DirectPlugin(ImagerPlugin): def update_fstab(self, image_rootfs): """Assume partition order same as in wks""" + + def _get_mountpoint(line): + """return the mount point of an fstab entry or None""" + parts = line.split() + if line.startswith('#') or len(parts) != 6: + return None + return parts[1] + if not image_rootfs: return @@ -142,6 +150,8 @@ class DirectPlugin(ImagerPlugin): line = "\t".join([device_name, part.mountpoint, part.fstype, opts, "0", passno]) + "\n" + # if this mountpoint is already in the fstab, replace it + fstab_lines = [item for item in fstab_lines if _get_mountpoint(item) != part.mountpoint] fstab_lines.append(line) updated = True -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#175519): https://lists.openembedded.org/g/openembedded-core/message/175519 Mute This Topic: https://lists.openembedded.org/mt/96070801/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
