public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Subject: [PATCH 5/7] initramfs-fsck-ext4-hook: Convert to hook.inc and improve
Date: Mon, 11 Nov 2024 21:50:22 +0100	[thread overview]
Message-ID: <119732ece3ac710416516282f0cdcb5c05c9b4d1.1731358224.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1731358224.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Use the convention and helping features of the new initramfs hook.inc to
simplify this hook. We move it under recipes-initramfs to align with
other recipes there. Another change is making fsck.ext4 mandatory, both
as dependency and while copying it in via the helper - there is no
reason for this recipe to almost silently ignore any unavailability.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../images/isar-initramfs.bb                  |  2 +-
 .../files/initramfs-fsck-hook-ext4.triggers   |  0
 .../initramfs-fsck-ext4-hook_0.3.bb           | 14 +++++++
 .../files/initramfs.fsck.ext4.hook            | 39 -------------------
 .../initramfs-fsck-hook-ext4_0.2.bb           | 18 ---------
 5 files changed, 15 insertions(+), 58 deletions(-)
 rename meta/{recipes-support => recipes-initramfs}/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers (100%)
 create mode 100644 meta/recipes-initramfs/initramfs-fsck-hook/initramfs-fsck-ext4-hook_0.3.bb
 delete mode 100644 meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
 delete mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb

diff --git a/meta-isar/recipes-initramfs/images/isar-initramfs.bb b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
index 71dbaa43..d2a946f7 100644
--- a/meta-isar/recipes-initramfs/images/isar-initramfs.bb
+++ b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
@@ -15,5 +15,5 @@ INITRAMFS_PREINSTALL += " \
 # Recipes that should be installed into the initramfs build rootfs.
 INITRAMFS_INSTALL += " \
     initramfs-isar-example-hook \
-    initramfs-fsck-hook-ext4 \
+    initramfs-fsck-ext4-hook \
     "
diff --git a/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers b/meta/recipes-initramfs/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
similarity index 100%
rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
rename to meta/recipes-initramfs/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
diff --git a/meta/recipes-initramfs/initramfs-fsck-hook/initramfs-fsck-ext4-hook_0.3.bb b/meta/recipes-initramfs/initramfs-fsck-hook/initramfs-fsck-ext4-hook_0.3.bb
new file mode 100644
index 00000000..9e9654ad
--- /dev/null
+++ b/meta/recipes-initramfs/initramfs-fsck-hook/initramfs-fsck-ext4-hook_0.3.bb
@@ -0,0 +1,14 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019-2024
+#
+# SPDX-License-Identifier: MIT
+
+DESCRIPTION = "Recipe to add fsck hook to the initramfs"
+
+require recipes-initramfs/initramfs-hook/hook.inc
+
+SRC_URI += "file://initramfs-fsck-hook-ext4.triggers"
+
+HOOK_COPY_EXECS = "fsck fsck.ext4 logsave"
+
+DEBIAN_DEPENDS += ", e2fsprogs, logsave"
diff --git a/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook b/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
deleted file mode 100644
index 259b73b4..00000000
--- a/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
+++ /dev/null
@@ -1,39 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
-#
-# SPDX-License-Identifier: MIT
-
-#!/bin/sh
-
-set -e
-
-PREREQ=""
-
-prereqs()
-{
-     echo "$PREREQ"
-}
-
-case $1 in
-prereqs)
-     prereqs
-     exit 0
-     ;;
-esac
-
-. /usr/share/initramfs-tools/scripts/functions
-. /usr/share/initramfs-tools/hook-functions
-
-if [ ! -x /sbin/fsck ]; then
-	echo "Warning: couldn't find /sbin/fsck!"
-	exit 0
-fi
-
-copy_exec /sbin/fsck
-copy_exec /sbin/logsave
-
-if prog="$(command -v fsck.ext4)"; then
-  copy_exec "$prog"
-else
-  echo "Warning: /sbin/fsck.ext4 doesn't exist, can't install to initramfs, ignoring."
-fi
diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
deleted file mode 100644
index 9860dbc8..00000000
--- a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
-#
-# SPDX-License-Identifier: MIT
-
-
-DESCRIPTION = "Recipe to add fsck hook to the initramfs"
-
-inherit dpkg-raw
-SRC_URI = "file://initramfs-fsck-hook-ext4.triggers \
-           file://initramfs.fsck.ext4.hook \
-          "
-
-
-do_install() {
-        install -m 0755 -d ${D}/etc/initramfs-tools/hooks
-        install -m 0740 ${WORKDIR}/initramfs.fsck.ext4.hook ${D}/etc/initramfs-tools/hooks/fsck.ext4.hook
-}
-- 
2.43.0

-- 
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/119732ece3ac710416516282f0cdcb5c05c9b4d1.1731358224.git.jan.kiszka%40siemens.com.

  parent reply	other threads:[~2024-11-11 21:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11 20:50 [PATCH 0/7] Simplify writing initramfs hooks 'Jan Kiszka' via isar-users
2024-11-11 20:50 ` [PATCH 1/7] initramfs-hook: Add infrastructure to ease writing hooks 'Jan Kiszka' via isar-users
2024-11-12 10:00   ` 'Quirin Gylstorff' via isar-users
2024-11-12 10:14   ` 'Quirin Gylstorff' via isar-users
2024-11-13  6:43     ` 'Jan Kiszka' via isar-users
2024-11-13  7:47   ` [PATCH v2 " 'Jan Kiszka' via isar-users
2024-11-11 20:50 ` [PATCH 2/7] doc: Describe initramfs customizations 'Jan Kiszka' via isar-users
2024-11-11 20:50 ` [PATCH 3/7] isar-initramfs: Add initramfs-fsck-hook-ext4 'Jan Kiszka' via isar-users
2024-11-11 20:50 ` [PATCH 4/7] initramfs-isar-example-hook: Convert recipe over to new hook.inc 'Jan Kiszka' via isar-users
2024-11-11 20:50 ` 'Jan Kiszka' via isar-users [this message]
2024-11-11 20:50 ` [PATCH 6/7] initramfs-tee-ftpm-hook: Convert to hook.inc 'Jan Kiszka' via isar-users
2024-11-11 20:50 ` [PATCH 7/7] initramfs-tee-supplicant-hook: " 'Jan Kiszka' 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=119732ece3ac710416516282f0cdcb5c05c9b4d1.1731358224.git.jan.kiszka@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=quirin.gylstorff@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