public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] expand-on-first-boot: Add support for devicemapper
@ 2022-04-21 17:10 Jan Kiszka
  2022-04-21 17:43 ` Henning Schild
  2022-05-14 14:05 ` Anton Mikanovich
  0 siblings, 2 replies; 10+ messages in thread
From: Jan Kiszka @ 2022-04-21 17:10 UTC (permalink / raw)
  To: isar-users; +Cc: Christian Storm

From: Jan Kiszka <jan.kiszka@siemens.com>

When the rootfs is inside a devicemapper volume, e.g. dm-verity, the
script so far fails to identify the boot device. This adds at least
basic support for that case (single level, single slave). Once there is
a good example for more complex setups, this could be taken into account
as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../expand-on-first-boot/files/expand-last-partition.sh    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
index 7175dfd3..bb371e9f 100755
--- a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
+++ b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
@@ -10,8 +10,13 @@
 set -e
 
 ROOT_DEV="$(findmnt / -o source -n)"
-BOOT_DEV="$(echo "${ROOT_DEV}" | sed 's/p\?[0-9]*$//')"
+ROOT_DEV_NAME=${ROOT_DEV##*/}
+ROOT_DEV_SLAVE=$(ls -d /sys/block/${ROOT_DEV_NAME}/slaves/* 2>/dev/null | head -1)
+if [ -n ${ROOT_DEV_SLAVE} ]; then
+	ROOT_DEV=/dev/${ROOT_DEV_SLAVE##*/}
+fi
 
+BOOT_DEV="$(echo "${ROOT_DEV}" | sed 's/p\?[0-9]*$//')"
 if [ "${ROOT_DEV}" = "${BOOT_DEV}" ]; then
 	echo "Boot device equals root device - no partitioning found" >&2
 	exit 1
-- 
2.34.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-19 12:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 17:10 [PATCH] expand-on-first-boot: Add support for devicemapper Jan Kiszka
2022-04-21 17:43 ` Henning Schild
2022-04-21 18:49   ` Jan Kiszka
2022-04-21 19:05   ` Henning Schild
2022-04-22  6:28     ` Tobias Schaffner
2022-04-22  7:21       ` Henning Schild
2022-04-22  9:08       ` Jan Kiszka
2022-05-14 14:05 ` Anton Mikanovich
2022-05-19 11:51   ` Moessbauer, Felix
2022-05-19 12:23     ` Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox