similarity index 91%
rename from recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl
rename to recipes-initramfs/initramfs-overlay-hook/files/local-bottom.tmpl
@@ -1,32 +1,13 @@
-#!/bin/sh
#
# CIP Core, generic profile
#
-# Copyright (c) Siemens AG, 2022-2023
+# Copyright (c) Siemens AG, 2022-2024
#
# Authors:
# Jan Kiszka <jan.kiszka@siemens.com>
# Quirin Gylstorff <quirin.gylstorff@siemens.com>
#
-PREREQ=""
-
-prereqs()
-{
- echo "$PREREQ"
-}
-
-case $1 in
-# get pre-requisites
-prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-. /scripts/functions
-
-
ovl_partition_device="${INITRAMFS_OVERLAY_STORAGE_DEVICE}"
ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}"
ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}"
@@ -76,3 +57,5 @@ for ovl_lower_dir in ${ovl_lower_dirs}; do
panic "Can't mount overlay for '$ovl_lower_dir' !"
fi
done
+
+exit 0
deleted file mode 100644
@@ -1,34 +0,0 @@
-#!/bin/sh
-#
-# CIP Core, generic profile
-#
-# Copyright (c) Siemens AG, 2022
-#
-# Authors:
-# Jan Kiszka <jan.kiszka@siemens.com>
-#
-
-PREREQ=""
-prereqs()
-{
- echo "$PREREQ"
-}
-case $1 in
-prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-. /usr/share/initramfs-tools/hook-functions
-
-hook_error() {
- echo "(ERROR): $1" >&2
- exit 1
-}
-
-manual_add_modules overlay
-copy_exec /usr/bin/mountpoint || hook_error "/usr/bin/mountpoint not found"
-copy_exec /usr/bin/awk || hook_error "/usr/bin/awk not found"
-copy_exec /usr/sbin/e2fsck || hook_error "/usr/sbin/e2fsck not found"
-copy_exec /usr/sbin/mke2fs || hook_error "/usr/sbin/mke2fs not found"
similarity index 71%
rename from recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb
rename to recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb
@@ -1,7 +1,7 @@
#
# CIP Core, generic profile
#
-# Copyright (c) Siemens AG, 2022 - 2023
+# Copyright (c) Siemens AG, 2022 - 2024
#
# Authors:
# Jan Kiszka <jan.kiszka@siemens.com>
@@ -10,13 +10,12 @@
# SPDX-License-Identifier: MIT
#
-inherit dpkg-raw
+require recipes-initramfs/initramfs-hook/hook.inc
INITRAMFS_OVERLAY_RECOVERY_SCRIPT ??= "overlay_recovery_action.script"
SRC_URI += " \
- file://overlay.hook \
- file://overlay.script.tmpl \
+ file://local-bottom.tmpl \
file://${INITRAMFS_OVERLAY_RECOVERY_SCRIPT} \
"
@@ -34,7 +33,7 @@ INITRAMFS_OVERLAY_STORAGE_PATH ??= "/var/local"
INITRAMFS_OVERLAY_STORAGE_DEVICE ??= "/dev/disk/by-label/var"
INITRAMFS_OVERLAY_MOUNT_OPTION ??= "defaults,nodev,nosuid,noexec"
-TEMPLATE_FILES = "overlay.script.tmpl"
+TEMPLATE_FILES += "local-bottom.tmpl"
TEMPLATE_VARS += " INITRAMFS_OVERLAY_STORAGE_PATH \
INITRAMFS_OVERLAY_PATHS \
INITRAMFS_OVERLAY_STORAGE_DEVICE \
@@ -43,15 +42,10 @@ TEMPLATE_VARS += " INITRAMFS_OVERLAY_STORAGE_PATH \
DEBIAN_DEPENDS = "initramfs-tools, awk, coreutils, util-linux"
-do_install[cleandirs] += " \
- ${D}/usr/share/initramfs-tools/hooks \
- ${D}/usr/share/initramfs-tools/scripts/local-bottom"
+HOOK_ADD_MODULES = "overlay"
+HOOK_ADD_EXECS = "mountpoint awk e2fsck mke2fs"
-do_install() {
- install -m 0755 "${WORKDIR}/overlay.hook" \
- "${D}/usr/share/initramfs-tools/hooks/overlay"
- install -m 0755 "${WORKDIR}/overlay.script" \
- "${D}/usr/share/initramfs-tools/scripts/local-bottom/overlay"
+do_install:append() {
install -m 0755 "${WORKDIR}/${INITRAMFS_OVERLAY_RECOVERY_SCRIPT}" \
"${D}/usr/share/initramfs-tools/scripts"
}