From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7301408701728948224 X-Received: by 2002:a2e:b8d0:0:b0:2be:5485:4a99 with SMTP id s16-20020a2eb8d0000000b002be54854a99mr2519169ljp.4.1699991687546; Tue, 14 Nov 2023 11:54:47 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:b52a:0:b0:2c0:748:89af with SMTP id z10-20020a2eb52a000000b002c0074889afls804217ljm.2.-pod-prod-02-eu; Tue, 14 Nov 2023 11:54:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEu2vTIDZF83s+kRYSO032804kJOOdn7ki7iav93YP94tcrPjhgb+Mmxd0aRy1/EnAtz/v5 X-Received: by 2002:ac2:4834:0:b0:509:459b:13ae with SMTP id 20-20020ac24834000000b00509459b13aemr6521474lft.53.1699991685437; Tue, 14 Nov 2023 11:54:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699991685; cv=none; d=google.com; s=arc-20160816; b=mWbH2Lth+o/HfLDTbjDbh21Z2wuVACdu5vgjZgUkt+KD55b2bZfVl3SeMd8ppijJd4 UhGfgYewuyDjVHJs4qmsOasxsaKKJE1AXFKZXzow9XUf0WL1qmuSItcp5oNvWKDwziQl B/bB3rzRwuKahvr46qkzmghGYL5miKXSfF871Gg7HY2XGNjd+jEG48wPxUc47yzNkjGR g+cpvLH5OrtZ0bvrp6hHAcTP2ZLZwfTAJI08YaNvosW7Nm49eg13yB55QW95fKpfD7zB w+BeAE0LirdS1b1Eys78in7ByFzY/f16NE/xHBanyy04jSGji/C35AzlgBu03aH9BXCd lkTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:message-id:date :subject:cc:to:from:dkim-signature; bh=NA1a+ZxcwyN2z+Ddxyton9XZWFtRnDdgLAUkBnng6aU=; fh=1z37pEVhqwMLlkT4FDzOga7XBsM6Rzv6sXOq0pipxqo=; b=w4vzAimHjeit2iwjuNjrccj2W4BtIEHzwOzlNX7TU3wJZo/pn4/WvSvPnt2L/56lDX W4rdcrVTwYmKKI9HUPIeUsDckwPeOHXKwQnymbcDkt/5faOhnwtu6AdsBgqKjeUus0/u W/pJJZYUcuXZp2fGCyNO6ap11V7Hfd7Dmsi1f6mTi58nLVnNRIL04eu5412IKTQuTm3c QMDeZfb/NPdRG3AWNQx6jY2PLujqjGHTT3WnmKrssJetsPUbuWjPoydrhho9iEQUT/xW jHp5i7ym/tTsvrTRWQC1VjaG3yGNEJQJI1wI2u88VK8EEencOgzghkLQKFoA8j9jlyFS 6S0A== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=mw7mTJW5; spf=pass (google.com: domain of fm-1212295-202311141954449db369b262e8423432-yp9b5u@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-1212295-202311141954449db369b262e8423432-yP9b5U@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net. [185.136.64.228]) by gmr-mx.google.com with ESMTPS id bp29-20020a056512159d00b005090fd18c05si323422lfb.11.2023.11.14.11.54.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Nov 2023 11:54:45 -0800 (PST) Received-SPF: pass (google.com: domain of fm-1212295-202311141954449db369b262e8423432-yp9b5u@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) client-ip=185.136.64.228; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=mw7mTJW5; spf=pass (google.com: domain of fm-1212295-202311141954449db369b262e8423432-yp9b5u@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-1212295-202311141954449db369b262e8423432-yP9b5U@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 202311141954449db369b262e8423432 for ; Tue, 14 Nov 2023 20:54:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=cedric.hombourger@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc; bh=NA1a+ZxcwyN2z+Ddxyton9XZWFtRnDdgLAUkBnng6aU=; b=mw7mTJW5Knvmq0pOiWvlz3eGtkpXEpgZoizMFpIOYgnEuAYKYgbA7ysFyb8GH84Oe9bTJp kzKwQqH2zpN5UMtxqKMYYNCg7D5H70bW0si4bVgwIl1FWb4+u56NiwOvK/NW240D9NrvAmvB C3tNKuz+jbsCNSZXfbwMnpplGVRMU=; From: Cedric Hombourger To: isar-users@googlegroups.com Cc: Cedric Hombourger Subject: [PATCH] debianize: handle .triggers and .service files Date: Tue, 14 Nov 2023 20:54:27 +0100 Message-Id: <20231114195427.345320-1-cedric.hombourger@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1212295:519-21489:flowmailer X-TUID: 4cLITII7UtBw 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 --- 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