[RFC,2/2] meta/recipe-support: Use DEBIAN_SYSTEMD_SERVICE variable

Message ID 20240201130752.3734292-3-Quirin.Gylstorff@siemens.com
State RFC
Headers show
Series debianize: Use dh_installsystemd | expand

Commit Message

Quirin Gylstorff Feb. 1, 2024, 1:07 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Change recipes to use the new DEBIAN_SYSTEMD_SERVICE variable.

Also add comment to sshd-regen-keys to explain usage of the
old mechanism.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/recipes-support/enable-fsck/enable-fsck.bb            | 6 ++----
 meta/recipes-support/enable-fsck/files/postinst            | 3 ---
 .../expand-on-first-boot/expand-on-first-boot_1.4.bb       | 7 ++-----
 meta/recipes-support/expand-on-first-boot/files/postinst   | 3 ---
 .../recipes-support/sshd-regen-keys/sshd-regen-keys_0.4.bb | 1 +
 5 files changed, 5 insertions(+), 15 deletions(-)
 delete mode 100644 meta/recipes-support/enable-fsck/files/postinst
 delete mode 100644 meta/recipes-support/expand-on-first-boot/files/postinst

Patch

diff --git a/meta/recipes-support/enable-fsck/enable-fsck.bb b/meta/recipes-support/enable-fsck/enable-fsck.bb
index 0413f79d..b68d8f76 100644
--- a/meta/recipes-support/enable-fsck/enable-fsck.bb
+++ b/meta/recipes-support/enable-fsck/enable-fsck.bb
@@ -10,16 +10,14 @@  inherit dpkg-raw
 DESCRIPTION = "This service enables fsck on first boot"
 
 DEBIAN_DEPENDS = "systemd, sed, mount, initramfs-tools"
+DEBIAN_SYSTEMD_SERVICE = "enable-fsck.service"
 
 SRC_URI = " \
     file://enable-fsck.service \
     file://enable-fsck.sh \
-    file://postinst"
+    "
 
 do_install() {
-    install -d -m 755 ${D}/lib/systemd/system
-    install -m 644 ${WORKDIR}/enable-fsck.service ${D}/lib/systemd/system/
-
     install -d -m 755 ${D}/usr/share/enable-fsck
     install -m 755 ${WORKDIR}/enable-fsck.sh ${D}/usr/share/enable-fsck/
 }
diff --git a/meta/recipes-support/enable-fsck/files/postinst b/meta/recipes-support/enable-fsck/files/postinst
deleted file mode 100644
index 1c4c3bdb..00000000
--- a/meta/recipes-support/enable-fsck/files/postinst
+++ /dev/null
@@ -1,3 +0,0 @@ 
-#!/bin/sh
-
-systemctl enable enable-fsck.service
diff --git a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.4.bb b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.4.bb
index 0996000c..a24d1e9c 100644
--- a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.4.bb
+++ b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.4.bb
@@ -11,16 +11,13 @@  DESCRIPTION = "This service grows the last partition to the full medium during f
 MAINTAINER = "isar-users <isar-users@googlegroups.com>"
 
 DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), util-linux"
+DEBIAN_SYSTEMD_SERVICE = "expand-on-first-boot.service"
 
 SRC_URI = " \
     file://expand-on-first-boot.service \
     file://expand-last-partition.sh \
-    file://postinst"
-
+    "
 do_install() {
-    install -d -m 755 ${D}/lib/systemd/system
-    install -m 644 ${WORKDIR}/expand-on-first-boot.service ${D}/lib/systemd/system/
-
     install -d -m 755 ${D}/usr/share/expand-on-first-boot
     install -m 755 ${WORKDIR}/expand-last-partition.sh ${D}/usr/share/expand-on-first-boot/
 }
diff --git a/meta/recipes-support/expand-on-first-boot/files/postinst b/meta/recipes-support/expand-on-first-boot/files/postinst
deleted file mode 100644
index a190b01a..00000000
--- a/meta/recipes-support/expand-on-first-boot/files/postinst
+++ /dev/null
@@ -1,3 +0,0 @@ 
-#!/bin/sh
-
-systemctl enable expand-on-first-boot.service
diff --git a/meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.4.bb b/meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.4.bb
index 9ce1d8d8..b6d60814 100644
--- a/meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.4.bb
+++ b/meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.4.bb
@@ -5,6 +5,7 @@  DESCRIPTION = "Systemd service to regenerate sshd keys"
 MAINTAINER = "isar-users <isar-users@googlegroups.com>"
 DEBIAN_DEPENDS = "openssh-server, systemd"
 
+# postinst also removes exiting ssh keys
 SRC_URI = "file://postinst \
            file://sshd-regen-keys.service"