From: Quirin Gylstorff <Quirin.Gylstorff@siemens.com>
To: cip-dev@lists.cip-project.org, christian.storm@siemens.com,
jan.kiszka@siemens.com
Subject: [cip-dev][isar-cip-core][PATCH v3 6/8] overlay: add prerequisite 'encrypt_partition'
Date: Fri, 24 Feb 2023 17:28:30 +0100 [thread overview]
Message-ID: <20230224162832.327030-7-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20230224162832.327030-1-Quirin.Gylstorff@siemens.com>
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
If /var shall be encrypted encrypt_partition needs to be executed
before the overlay script.
If the prerequisite is not available the overlay script will be executed.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
.../initramfs-overlay-hook/files/overlay.hook | 1 +
.../initramfs-overlay-hook/files/overlay.script.tmpl | 12 +++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook b/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook
index 5bec258..bc6a682 100644
--- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook
+++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook
@@ -23,4 +23,5 @@ esac
. /usr/share/initramfs-tools/hook-functions
manual_add_modules overlay
+copy_exec /usr/bin/grep
copy_exec /usr/bin/awk
diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl
index 87ec72f..9739197 100644
--- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl
+++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl
@@ -9,7 +9,7 @@
# Quirin Gylstorff <quirin.gylstorff@siemens.com>
#
-PREREQ=""
+PREREQ="encrypt_partition"
prereqs()
{
@@ -33,10 +33,12 @@ ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}"
root_mount_storage=${rootmnt}${ovl_storage_path}
-if ! mount -t $(get_fstype /dev/disk/by-label/${ovl_partition_label}) \
- /dev/disk/by-label/${ovl_partition_label} \
- ${rootmnt}/${ovl_partition_label}; then
- panic "Can't mount /${ovl_partition_label} partition - overlay will not work!"
+if ! grep -q "${rootmnt}/${ovl_partition_label}" /proc/mounts ; then
+ if ! mount -t $(get_fstype /dev/disk/by-label/${ovl_partition_label}) \
+ /dev/disk/by-label/${ovl_partition_label} \
+ ${rootmnt}/${ovl_partition_label}; then
+ panic "Can't mount /${ovl_partition_label} partition - overlay will not work!"
+ fi
fi
for ovl_lower_dir in ${ovl_lower_dirs}; do
--
2.39.1
next prev parent reply other threads:[~2023-02-24 16:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 16:28 [cip-dev][isar-cip-core][PATCH v3 0/8] Encrypt Partition in initramfs Quirin Gylstorff
2023-02-24 16:28 ` [cip-dev][isar-cip-core][PATCH v3 1/8] linux-cip: update kernel configuration for tpm2 support Quirin Gylstorff
2023-02-24 16:28 ` [cip-dev][isar-cip-core][PATCH v3 2/8] use bullseye backports for systemd-cryptenroll Quirin Gylstorff
2023-02-27 7:08 ` Jan Kiszka
2023-02-24 16:28 ` [cip-dev][isar-cip-core][PATCH v3 3/8] KConfig: add tpm option Quirin Gylstorff
2023-02-27 7:09 ` Jan Kiszka
2023-02-24 16:28 ` [cip-dev][isar-cip-core][PATCH v3 4/8] start-qemu.sh: Create a tpm2 device Quirin Gylstorff
2023-02-27 7:11 ` Jan Kiszka
2023-02-24 16:28 ` [cip-dev][isar-cip-core][PATCH v3 5/8] Add initramfs hook to encrypt a partition Quirin Gylstorff
2023-02-27 7:19 ` Jan Kiszka
2023-02-24 16:28 ` Quirin Gylstorff [this message]
2023-02-27 7:24 ` [cip-dev][isar-cip-core][PATCH v3 6/8] overlay: add prerequisite 'encrypt_partition' Jan Kiszka
2023-02-24 16:28 ` [cip-dev][isar-cip-core][PATCH v3 7/8] .gitlabci: Add ci build Quirin Gylstorff
2023-02-24 16:28 ` [cip-dev][isar-cip-core][PATCH v3 8/8] Add README for encrypted partitions Quirin Gylstorff
2023-02-27 8:23 ` Jan Kiszka
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=20230224162832.327030-7-Quirin.Gylstorff@siemens.com \
--to=quirin.gylstorff@siemens.com \
--cc=christian.storm@siemens.com \
--cc=cip-dev@lists.cip-project.org \
--cc=jan.kiszka@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.