From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 13 Dec 2023 15:48:16 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rDQX1-002G6q-0U for lore@lore.pengutronix.de; Wed, 13 Dec 2023 15:48:15 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rDQX1-0007dD-DR; Wed, 13 Dec 2023 15:48:15 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rDQWt-0007TK-QZ; Wed, 13 Dec 2023 15:48:07 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rDQWt-00FapO-D4; Wed, 13 Dec 2023 15:48:07 +0100 Received: from rhi by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rDQWt-0081CP-19; Wed, 13 Dec 2023 15:48:07 +0100 From: Roland Hieber To: distrokit@pengutronix.de Date: Wed, 13 Dec 2023 15:47:49 +0100 Message-Id: <20231213144750.1899431-4-rhi@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231213144750.1899431-1-rhi@pengutronix.de> References: <20231213144750.1899431-1-rhi@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH next v3 3/4] squash! datapartition: generate partitions via systemd-repart X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roland Hieber Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false [@rsc: please replace the last paragraph in the original commit message by the following text:] Remove the old systemd-autoformat service and the mkfs-ext4 udev rule, which also only handled the case where the data partition was the third partition on the disk (which is not always the case anymore since we have partitions for barebox-state or device-specific firmware), and replace it with a call to systemd-repart if the root partition is on a disk that we can actually repartition (i.e. /dev/root is not emulated via qemu; this should also match the case when we are running from initrd, but this has not been tested.) Use a custom Type UUID instead of "linux-generic" for the data partition to prevent systemd-repart from matching any bootloader partitions that could throw off the matching algorithm (e.g. on STM32MP1). Signed-off-by: Roland Hieber --- projectroot/etc/rc.once.d/repart | 10 ++++++++-- projectroot/etc/repart.rc-once.d/30-data.conf | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/projectroot/etc/rc.once.d/repart b/projectroot/etc/rc.once.d/repart index 675c4e3e57f4..c84ab31f67a1 100755 --- a/projectroot/etc/rc.once.d/repart +++ b/projectroot/etc/rc.once.d/repart @@ -1,3 +1,9 @@ #!/bin/sh -echo "Repartitioning the root disk..." -systemd-repart --dry-run=no --definitions=/etc/repart.rc-once.d/ +if rdev | grep -q '/dev/hd.*[0-9]\|/dev/mmcblk.*[0-9]\|/dev/sd.*[0-9]\|/dev/vd.*[0-9])'; then + echo "Repartitioning the root disk..." + systemd-repart --dry-run=no --definitions=/etc/repart.rc-once.d/ +else + # root is not on a partitionable disk; probably running in qemu or initrd + echo "Note: no root device or root not on a disk, not running systemd-repart" + exit 0 +fi diff --git a/projectroot/etc/repart.rc-once.d/30-data.conf b/projectroot/etc/repart.rc-once.d/30-data.conf index cc5aebfd87d3..1f663bc275d6 100644 --- a/projectroot/etc/repart.rc-once.d/30-data.conf +++ b/projectroot/etc/repart.rc-once.d/30-data.conf @@ -1,6 +1,7 @@ [Partition] Label=data -Type=linux-generic +# don't use "linux-generic" to prevent incorrectly matching any bootloader partitions +Type=da7af157-d639-49e9-89a0-fc74beeb8954 SizeMinBytes=200M Weight=999999 Format=ext4 -- 2.39.2