[1/2] Mask systemd-firstboot

Message ID 20221119182031.2005807-2-tobias.schaffner@siemens.com
State Accepted, archived
Headers show
Series Mask systemd-firstboot | expand

Commit Message

Tobias Schaffner Nov. 19, 2022, 6:20 p.m. UTC
From: Tobias Schaffner <tobias.schaffner@siemens.com>

systemd-firstboot asks the user interactively for missing system configurations
like locale or hostname.

Disable the service as we do not want to depend on user interaction on boot.

Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
---
 meta/classes/image-postproc-extension.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/meta/classes/image-postproc-extension.bbclass b/meta/classes/image-postproc-extension.bbclass
index 4a901cb..942b929 100644
--- a/meta/classes/image-postproc-extension.bbclass
+++ b/meta/classes/image-postproc-extension.bbclass
@@ -79,3 +79,14 @@  image_postprocess_sshd_key_regen() {
        exit 1
     fi
 }
+
+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" )
+
+    if dpkg --compare-versions "$SYSTEMD_VERSION" "ge" "251"; then
+        sudo chroot '${ROOTFSDIR}' systemctl mask systemd-firstboot
+    fi
+}