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 v3 4/7] initramfs-isar-example-hook: Convert recipe over to new hook.inc
Date: Sat, 16 Nov 2024 11:55:49 +0100	[thread overview]
Message-ID: <a0fb4ba14224894e66f64a340be380caf9ca0bb8.1731754552.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1731754552.git.jan.kiszka@siemens.com>

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

Allows to drop the own hook recipe and makes the local-top boot script
effectively a one-liner.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../images/isar-initramfs.bb                  |  2 +-
 .../initramfs-example/files/example.hook      | 21 -----------------
 .../initramfs-example/files/example.script    | 23 -------------------
 .../initramfs-example/files/local-top         |  3 +++
 ....bb => initramfs-isar-example-hook_0.1.bb} | 21 ++++++-----------
 5 files changed, 11 insertions(+), 59 deletions(-)
 delete mode 100644 meta-isar/recipes-initramfs/initramfs-example/files/example.hook
 delete mode 100644 meta-isar/recipes-initramfs/initramfs-example/files/example.script
 create mode 100644 meta-isar/recipes-initramfs/initramfs-example/files/local-top
 rename meta-isar/recipes-initramfs/initramfs-example/{initramfs-example.bb => initramfs-isar-example-hook_0.1.bb} (63%)

diff --git a/meta-isar/recipes-initramfs/images/isar-initramfs.bb b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
index 4df9e0b8..71dbaa43 100644
--- a/meta-isar/recipes-initramfs/images/isar-initramfs.bb
+++ b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
@@ -14,6 +14,6 @@ INITRAMFS_PREINSTALL += " \
 
 # Recipes that should be installed into the initramfs build rootfs.
 INITRAMFS_INSTALL += " \
-    initramfs-example \
+    initramfs-isar-example-hook \
     initramfs-fsck-hook-ext4 \
     "
diff --git a/meta-isar/recipes-initramfs/initramfs-example/files/example.hook b/meta-isar/recipes-initramfs/initramfs-example/files/example.hook
deleted file mode 100644
index ba848c92..00000000
--- a/meta-isar/recipes-initramfs/initramfs-example/files/example.hook
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Example hook script.
-#
-# See "HOOK SCRIPTS" in initramfs-tools(7) for details.
-
-set -e
-
-PREREQ=""
-prereqs()
-{
-    echo "$PREREQ"
-}
-case $1 in
-prereqs)
-    prereqs
-    exit 0
-    ;;
-esac
-
-. /usr/share/initramfs-tools/hook-functions
-# Begin real processing below this line
diff --git a/meta-isar/recipes-initramfs/initramfs-example/files/example.script b/meta-isar/recipes-initramfs/initramfs-example/files/example.script
deleted file mode 100644
index c55e9ea7..00000000
--- a/meta-isar/recipes-initramfs/initramfs-example/files/example.script
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-# Example boot script.
-#
-# See "BOOT SCRIPTS" in initramfs-tools(7) for details.
-
-set -e
-
-PREREQ=""
-prereqs()
-{
-    echo "$PREREQ"
-}
-case $1 in
-prereqs)
-    prereqs
-    exit 0
-    ;;
-esac
-
-. /scripts/functions
-# Begin real processing below this line
-
-log_success_msg "Hello from ISAR!"
diff --git a/meta-isar/recipes-initramfs/initramfs-example/files/local-top b/meta-isar/recipes-initramfs/initramfs-example/files/local-top
new file mode 100644
index 00000000..66e382b4
--- /dev/null
+++ b/meta-isar/recipes-initramfs/initramfs-example/files/local-top
@@ -0,0 +1,3 @@
+# Script header is provided by initramfs-hook/hook.inc
+
+log_success_msg "Hello from ISAR!"
diff --git a/meta-isar/recipes-initramfs/initramfs-example/initramfs-example.bb b/meta-isar/recipes-initramfs/initramfs-example/initramfs-isar-example-hook_0.1.bb
similarity index 63%
rename from meta-isar/recipes-initramfs/initramfs-example/initramfs-example.bb
rename to meta-isar/recipes-initramfs/initramfs-example/initramfs-isar-example-hook_0.1.bb
index c336dda9..8c600639 100644
--- a/meta-isar/recipes-initramfs/initramfs-example/initramfs-example.bb
+++ b/meta-isar/recipes-initramfs/initramfs-example/initramfs-isar-example-hook_0.1.bb
@@ -4,37 +4,30 @@
 #
 # This software is a part of ISAR.
 
+require recipes-initramfs/initramfs-hook/hook.inc
+
 DESCRIPTION = "Sample initramfs module for ISAR"
 MAINTAINER = "Your name here <you@domain.com>"
-DEBIAN_DEPENDS = "initramfs-tools"
 
 # If the conf-hook enables BUSYBOX=y, busybox is needed:
 DEBIAN_DEPENDS .= ", busybox"
 
-SRC_URI = " \
+SRC_URI += " \
     file://example.conf-hook \
-    file://example.hook \
-    file://example.script \
+    file://local-top \
     "
 
-inherit dpkg-raw
-
 do_install[cleandirs] += " \
     ${D}/usr/share/initramfs-tools/conf-hooks.d \
-    ${D}/usr/share/initramfs-tools/hooks \
-    ${D}/usr/share/initramfs-tools/scripts/local-top \
     "
-do_install() {
+do_install:append() {
     # See "CONFIGURATION HOOK SCRIPTS" in initramfs-tools(7) for details.
     install "${WORKDIR}/example.conf-hook" \
         "${D}/usr/share/initramfs-tools/conf-hooks.d/isar-example"
 
-    # See "HOOK SCRIPTS" in initramfs-tools(7) for details.
-    install "${WORKDIR}/example.hook" \
-        "${D}/usr/share/initramfs-tools/hooks/isar-example"
+    # See "HOOK SCRIPTS" in initramfs-tools(7) for details on
+    # hook-header[.tmpl] + hook.
 
     # Note that there are other places where a boot script might be deployed to,
     # apart from local-top.  See "BOOT SCRIPTS" in initramfs-tools(7) for details.
-    install "${WORKDIR}/example.script" \
-        "${D}/usr/share/initramfs-tools/scripts/local-top/example.script"
 }
-- 
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/a0fb4ba14224894e66f64a340be380caf9ca0bb8.1731754552.git.jan.kiszka%40siemens.com.

  parent reply	other threads:[~2024-11-16 10:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 10:55 [PATCH v3 0/7] Simplify writing initramfs hooks 'Jan Kiszka' via isar-users
2024-11-16 10:55 ` [PATCH v3 1/7] initramfs-hook: Add infrastructure to ease writing hooks 'Jan Kiszka' via isar-users
2024-11-16 10:55 ` [PATCH v3 2/7] doc: Describe initramfs customizations 'Jan Kiszka' via isar-users
2024-11-16 10:55 ` [PATCH v3 3/7] isar-initramfs: Add initramfs-fsck-hook-ext4 'Jan Kiszka' via isar-users
2024-11-16 10:55 ` 'Jan Kiszka' via isar-users [this message]
2024-11-16 10:55 ` [PATCH v3 5/7] initramfs-fsck-ext4-hook: Convert to hook.inc and improve 'Jan Kiszka' via isar-users
2024-11-16 10:55 ` [PATCH v3 6/7] initramfs-tee-ftpm-hook: Convert to hook.inc 'Jan Kiszka' via isar-users
2024-11-16 10:55 ` [PATCH v3 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=a0fb4ba14224894e66f64a340be380caf9ca0bb8.1731754552.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