[PATCH v2 1/4] initramfs-crypt-hook: make sure that mount path exists

Claudius Heine
2025-02-27T14:30:49Z

Wherever or not the mount directory (and their parents) gets created
seem to be inconsistent; mentioning a missing mount point in the
`/etc/fstab` might cause the boot to fail, while using systemd `.mount`
units will just create the mount point.

Wic creates missing mount points that where mentioned in the `.wks`
file; so moving from such a setup to letting `initramfs-crypt-hook`
mount the file system at boot inside the ramdisk, the mount would
suddenly fail.

Therefore creating the mount point for your, if it doesn't exists seem to
provide a smoother transition.

Signed-off-by: Claudius Heine <ch@denx.de>
---
.../initramfs-crypt-hook/files/local-bottom-complete | 1 +
1 file changed, 1 insertion(+)

diff --git a/recipes-initramfs/initramfs-crypt-hook/files/local-bottom-complete b/recipes-initramfs/initramfs-crypt-hook/files/local-bottom-complete
index b991cb4..80553d1 100644
--- a/recipes-initramfs/initramfs-crypt-hook/files/local-bottom-complete
+++ b/recipes-initramfs/initramfs-crypt-hook/files/local-bottom-complete
@@ -41,6 +41,7 @@ mount_partition() {
partition_mountpoint=$2
[ "$debug" = "y" ] && echo "mount device: '$partition_dev_path' to '$partition_mountpoint'"
if ! mountpoint -q "${partition_mountpoint}"; then
+ mkdir -p "${partition_mountpoint}"
if ! mount -t "$(get_fstype "${partition_dev_path}")" "${partition_dev_path}" \
"${partition_mountpoint}"; then
panic "Can't mount partition '${partition_dev_path}'!"
--
2.47.2