diff mbox series

[isar-cip-core,v4,2/9] initramfs: allow empty mountpoint for crypt hooks

Message ID 20240502093240.364093-3-Quirin.Gylstorff@siemens.com (mailing list archive)
State Superseded
Headers show
Series Add option to encrypt the rootfs | expand

Commit Message

Quirin Gylstorff May 2, 2024, 9:31 a.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows to encrypt partition which have as seperate mount
script like verity and abrootfs

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../initramfs-crypt-hook/files/mount_crypt_partitions.script  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Felix Moessbauer May 3, 2024, 11:07 a.m. UTC | #1
On Thu, 2024-05-02 at 11:31 +0200, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This allows to encrypt partition which have as seperate mount
---------------------------------^ partitions -^ a separate ...

Felix

> script like verity and abrootfs
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  .../initramfs-crypt-hook/files/mount_crypt_partitions.script  | 4
> +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/recipes-initramfs/initramfs-crypt-
> hook/files/mount_crypt_partitions.script b/recipes-
> initramfs/initramfs-crypt-hook/files/mount_crypt_partitions.script
> index 3411e70..b72323f 100644
> --- a/recipes-initramfs/initramfs-crypt-
> hook/files/mount_crypt_partitions.script
> +++ b/recipes-initramfs/initramfs-crypt-
> hook/files/mount_crypt_partitions.script
> @@ -51,7 +51,9 @@ for partition_set in $partition_sets; do
>         part_device=$(readlink -f "$partition")
>         crypt_mount_name="encrypted_$partition_label"
>         decrypted_part=/dev/mapper/"$crypt_mount_name"
> -
> +       if [ -z "$partition_mountpoint" ]; then
> +               continue
> +       fi
>         if /usr/sbin/cryptsetup luksDump --batch-mode "$part_device"
> \
>                         | grep -q "luks2"; then
>                 mount_partition "$decrypted_part"
> "${rootmnt}""$partition_mountpoint"
diff mbox series

Patch

diff --git a/recipes-initramfs/initramfs-crypt-hook/files/mount_crypt_partitions.script b/recipes-initramfs/initramfs-crypt-hook/files/mount_crypt_partitions.script
index 3411e70..b72323f 100644
--- a/recipes-initramfs/initramfs-crypt-hook/files/mount_crypt_partitions.script
+++ b/recipes-initramfs/initramfs-crypt-hook/files/mount_crypt_partitions.script
@@ -51,7 +51,9 @@  for partition_set in $partition_sets; do
 	part_device=$(readlink -f "$partition")
 	crypt_mount_name="encrypted_$partition_label"
 	decrypted_part=/dev/mapper/"$crypt_mount_name"
-
+	if [ -z "$partition_mountpoint" ]; then
+		continue
+	fi
 	if /usr/sbin/cryptsetup luksDump --batch-mode "$part_device" \
 			| grep -q "luks2"; then
 		mount_partition "$decrypted_part" "${rootmnt}""$partition_mountpoint"