From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Christian Storm <christian.storm@siemens.com>
Subject: [PATCH] expand-on-first-boot: Add support for devicemapper
Date: Thu, 21 Apr 2022 19:10:44 +0200 [thread overview]
Message-ID: <8965f42b-0813-bf3e-a7ec-023d2b41db4f@siemens.com> (raw)
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
next reply other threads:[~2022-04-21 17:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 17:10 Jan Kiszka [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8965f42b-0813-bf3e-a7ec-023d2b41db4f@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=christian.storm@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox