public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] debianize: handle .triggers and .service files
@ 2023-11-14 19:54 Cedric Hombourger
  2023-11-14 20:22 ` MOESSBAUER, Felix
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Cedric Hombourger @ 2023-11-14 19:54 UTC (permalink / raw)
  To: isar-users; +Cc: Cedric Hombourger

Some packages need to update/rebuild the initramfs and this is particularly
slow on Debian systems (which are not using more modern technologies such
as dracut or mkosi). Instead of having each package call update-initramfs,
use a trigger instead to have dpkg defer that call to the very end of the
transaction. Many packages also failed to rebuild the initramfs when the
package gets removed. Demonstrate use with initramfs-fsck-hook-ext4.

Other packages ship systemd units and usually do this using do_install()
and a postinst script. Such recipes also fail to handle the removal of
such packages. By naming the unit ${PN}.service and putting it under
debian/, debhelper will generate the necessary maintainer scripts
(preinst, postinst, prerm, postrm).

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
 meta/classes/debianize.bbclass                            | 8 ++++++++
 ...d-on-first-boot_1.4.bb => expand-on-first-boot_1.5.bb} | 6 +-----
 meta/recipes-support/expand-on-first-boot/files/postinst  | 3 ---
 .../files/{postinst => initramfs-fsck-hook-ext4.triggers} | 5 ++---
 ...k-hook-ext4_0.1.bb => initramfs-fsck-hook-ext4_0.2.bb} | 2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)
 rename meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.4.bb => expand-on-first-boot_1.5.bb} (78%)
 delete mode 100644 meta/recipes-support/expand-on-first-boot/files/postinst
 rename meta/recipes-support/initramfs-fsck-hook/files/{postinst => initramfs-fsck-hook-ext4.triggers} (51%)
 rename meta/recipes-support/initramfs-fsck-hook/{initramfs-fsck-hook-ext4_0.1.bb => initramfs-fsck-hook-ext4_0.2.bb} (88%)

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index df7c5b50..25ae2023 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -138,4 +138,12 @@ deb_debianize() {
 			fi
 		done
 	done
+
+	# handle PN.service and PN.triggers files for use with debhelper
+	for f in service triggers
+	do
+		if [ -f ${WORKDIR}/${PN}.${f} ]; then
+			install -v -m 644 ${WORKDIR}/${PN}.${f} ${S}/debian/
+		fi
+	done
 }
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.5.bb
similarity index 78%
rename from meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.4.bb
rename to meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.5.bb
index 0996000c..1b5b066b 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.5.bb
@@ -14,13 +14,9 @@ DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29
 
 SRC_URI = " \
     file://expand-on-first-boot.service \
-    file://expand-last-partition.sh \
-    file://postinst"
+    file://expand-last-partition.sh"
 
 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/initramfs-fsck-hook/files/postinst b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
similarity index 51%
rename from meta/recipes-support/initramfs-fsck-hook/files/postinst
rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
index 07bc3d94..db45dfdc 100644
--- a/meta/recipes-support/initramfs-fsck-hook/files/postinst
+++ b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
@@ -1,6 +1,5 @@
-#!/bin/sh
 # This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
+# Copyright (C) Siemens AG, 2023
 #
 # SPDX-License-Identifier: MIT
-update-initramfs -u
+activate-await update-initramfs
diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
similarity index 88%
rename from meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb
rename to meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
index 0be52a3b..9860dbc8 100644
--- a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb
+++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
@@ -7,7 +7,7 @@
 DESCRIPTION = "Recipe to add fsck hook to the initramfs"
 
 inherit dpkg-raw
-SRC_URI = "file://postinst \
+SRC_URI = "file://initramfs-fsck-hook-ext4.triggers \
            file://initramfs.fsck.ext4.hook \
           "
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-26 20:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14 19:54 [PATCH] debianize: handle .triggers and .service files Cedric Hombourger
2023-11-14 20:22 ` MOESSBAUER, Felix
2023-11-15  8:36   ` Jan Kiszka
2023-11-15  8:43     ` MOESSBAUER, Felix
2023-11-15  8:57       ` cedric.hombourger
2023-11-15  9:03         ` MOESSBAUER, Felix
2023-11-16 12:38       ` Jan Kiszka
2024-03-07  7:23 ` Uladzimir Bely
2024-03-26 20:15 ` Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox