From: "'Cedric Hombourger' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: felix.moessbauer@siemens.com,
Cedric Hombourger <cedric.hombourger@siemens.com>
Subject: [PATCH 3/4] image-postproc-extension: refactor systemd version checks
Date: Mon, 19 May 2025 13:57:49 +0200 [thread overview]
Message-ID: <20250519115750.3195300-4-cedric.hombourger@siemens.com> (raw)
In-Reply-To: <20250519115750.3195300-1-cedric.hombourger@siemens.com>
Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
meta/classes/image-postproc-extension.bbclass | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/meta/classes/image-postproc-extension.bbclass b/meta/classes/image-postproc-extension.bbclass
index 991bac4c..0af588d8 100644
--- a/meta/classes/image-postproc-extension.bbclass
+++ b/meta/classes/image-postproc-extension.bbclass
@@ -53,12 +53,17 @@ image_postprocess_mark() {
--build-id "${BUILD_ID}" --variant "${DESCRIPTION}" --version "${PV}"
}
+# Use dpkg to find out which version of systemd is installed into the image or reports "0"
+image_systemd_version() {
+ sudo chroot ${IMAGE_ROOTFS} dpkg-query --showformat='${source:Upstream-Version}' --show systemd || echo "0"
+}
+
ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
image_postprocess_machine_id() {
# systemd(1) takes care of recreating the machine-id on first boot
# for systemd < v247, set to empty string, else set to uninitialized
# (required if initramfs with ro root is used)
- SYSTEMD_VERSION=$( sudo chroot ${IMAGE_ROOTFS} dpkg-query --showformat='${source:Upstream-Version}' --show systemd || echo "0" )
+ SYSTEMD_VERSION=$( image_systemd_version )
MACHINE_ID="uninitialized"
if dpkg --compare-versions "$SYSTEMD_VERSION" "lt" "247"; then
MACHINE_ID=""
@@ -82,10 +87,7 @@ image_postprocess_sshd_key_regen() {
ROOTFS_POSTPROCESS_COMMAND =+ "image_posprocess_disable_systemd_firstboot"
image_posprocess_disable_systemd_firstboot() {
- SYSTEMD_VERSION=$(sudo chroot '${ROOTFSDIR}' dpkg-query \
- --showformat='${source:Upstream-Version}' \
- --show systemd || echo "0" )
-
+ SYSTEMD_VERSION=$( image_systemd_version )
if dpkg --compare-versions "$SYSTEMD_VERSION" "ge" "251"; then
sudo chroot '${ROOTFSDIR}' systemctl mask systemd-firstboot
if ! cmd_output=$(sudo chroot '${ROOTFSDIR}' systemd-firstboot \
--
2.39.5
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250519115750.3195300-4-cedric.hombourger%40siemens.com.
next prev parent reply other threads:[~2025-05-19 11:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 15:07 [RFC PATCH 0/2] optimize caching of source packages 'Cedric Hombourger' via isar-users
2025-05-15 15:07 ` [RFC PATCH 1/2] rootfs: introduce wrapper to run native commands against a rootfs 'Cedric Hombourger' via isar-users
2025-05-19 11:57 ` [PATCH 0/4] non-privileged commands in chroot 'Cedric Hombourger' via isar-users
2025-05-19 11:57 ` [PATCH 1/4] rootfs: introduce wrapper to run commands against a rootfs 'Cedric Hombourger' via isar-users
2025-05-22 14:32 ` 'MOESSBAUER, Felix' via isar-users
2025-06-05 6:42 ` 'cedric.hombourger@siemens.com' via isar-users
2025-06-05 12:20 ` 'MOESSBAUER, Felix' via isar-users
2025-06-05 12:43 ` Baurzhan Ismagulov
2025-06-06 6:05 ` 'cedric.hombourger@siemens.com' via isar-users
2025-06-05 13:57 ` 'Jan Kiszka' via isar-users
2025-06-06 6:02 ` 'cedric.hombourger@siemens.com' via isar-users
2025-06-06 6:11 ` 'Jan Kiszka' via isar-users
2025-05-19 11:57 ` [PATCH 2/4] deb-dl-dir: optimize caching of source packages using apt natively 'Cedric Hombourger' via isar-users
2025-05-19 11:57 ` 'Cedric Hombourger' via isar-users [this message]
2025-05-19 11:57 ` [PATCH 4/4] image-postproc-extension: extract systemd's version using rootfs_cmd 'Cedric Hombourger' via isar-users
2025-05-19 13:33 ` [PATCH 0/4] non-privileged commands in chroot Srinuvasan Arjunan
2025-06-18 13:50 ` [PATCH v2 " 'Cedric Hombourger' via isar-users
2025-06-18 13:50 ` [PATCH v2 1/4] rootfs: introduce wrapper to run commands against a rootfs 'Cedric Hombourger' via isar-users
2025-06-18 13:50 ` [PATCH v2 2/4] deb-dl-dir: optimize caching of source packages using apt natively 'Cedric Hombourger' via isar-users
2025-06-18 13:50 ` [PATCH v2 3/4] image-postproc-extension: refactor systemd version checks 'Cedric Hombourger' via isar-users
2025-06-18 13:50 ` [PATCH v2 4/4] image-postproc-extension: extract systemd's version using rootfs_cmd 'Cedric Hombourger' via isar-users
2025-06-20 9:16 ` 'Quirin Gylstorff' via isar-users
2025-05-15 15:07 ` [RFC PATCH 2/2] deb-dl-dir: optimize caching of source packages using apt natively 'Cedric Hombourger' via isar-users
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=20250519115750.3195300-4-cedric.hombourger@siemens.com \
--to=isar-users@googlegroups.com \
--cc=cedric.hombourger@siemens.com \
--cc=felix.moessbauer@siemens.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