public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Q. Gylstorff" <Quirin.Gylstorff@siemens.com>
To: isar-users@googlegroups.com
Cc: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Subject: [PATCH v2] recipes-support: add fsck to initramfs
Date: Thu, 22 Aug 2019 15:07:13 +0200	[thread overview]
Message-ID: <20190822130713.3908-1-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <d6de6473-6d51-99d5-2517-273e20982d22@siemens.com>

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

During system start it shall be possible to check all available file systems.
As debootstrap has no knowledge of the existing file system it will not add all fsck.*
application necessary to the initramfs.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../files/initramfs.fsck.ext4.hook            | 38 +++++++++++++++++++
 .../initramfs-fsck-hook/files/postinst        |  6 +++
 .../initramfs-fsck-hook-ext4_0.1.bb           | 18 +++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
 create mode 100644 meta/recipes-support/initramfs-fsck-hook/files/postinst
 create mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb

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
new file mode 100644
index 0000000..23f7c28
--- /dev/null
+++ b/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
@@ -0,0 +1,38 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+#!/bin/sh
+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
+
+fsck_types="ext4"
+
+copy_exec /sbin/fsck
+copy_exec /sbin/logsave
+
+if prog="$(command -v fsck.${type})"; then
+  copy_exec "$prog"
+else
+  echo "Warning: /sbin/fsck.${type} doesn't exist, can't install to initramfs, ignoring."
+fi
diff --git a/meta/recipes-support/initramfs-fsck-hook/files/postinst b/meta/recipes-support/initramfs-fsck-hook/files/postinst
new file mode 100644
index 0000000..07bc3d9
--- /dev/null
+++ b/meta/recipes-support/initramfs-fsck-hook/files/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+update-initramfs -u
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.1.bb
new file mode 100644
index 0000000..0be52a3
--- /dev/null
+++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb
@@ -0,0 +1,18 @@
+# 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://postinst \
+           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.20.1


  reply	other threads:[~2019-08-22 13:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  7:59 [PATCH] " Q. Gylstorff
2019-08-13 14:36 ` Henning Schild
2019-08-13 15:01   ` Jan Kiszka
2019-08-14 16:31     ` Henning Schild
2019-08-19  7:00       ` Quirin Gylstorff
2019-08-22 13:07         ` Q. Gylstorff [this message]
2019-09-04 12:32           ` [PATCH v2] " Baurzhan Ismagulov
2019-08-13 15:31   ` [PATCH] " Claudius Heine

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=20190822130713.3908-1-Quirin.Gylstorff@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=isar-users@googlegroups.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