[make-initrd] [PATCH v6 06/22] bootchain-waitdev: improving the logic of the step
Leonid Krivoshein
klark.devel at gmail.com
Sun Oct 24 20:20:46 MSK 2021
1. Breaks the loop when the specified device is actually found.
2. Send a message to the log about the detection of the specified device.
3. Also save the device's real node name to the DEVNAME file.
Signed-off-by: Leonid Krivoshein <klark.devel at gmail.com>
---
features/bootchain-core/README.md | 6 ++++++
features/bootchain-waitdev/data/lib/bootchain/waitdev | 9 ++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/features/bootchain-core/README.md b/features/bootchain-core/README.md
index 0ccacd9..7f12f1d 100644
--- a/features/bootchain-core/README.md
+++ b/features/bootchain-core/README.md
@@ -49,6 +49,12 @@ us to optimize fill in `initramfs` only which we are need.
- Modularity: loading methods are initially separated from the common
code and daemon.
+- Allows you to work with shorter and more familiar paths to special files
+ devices thanks to the use of `DEVNAME` along with `dev`.
+
+Despite the differences, `chaind` is backward compatible with previously
+written steps for the `pipelined` daemon and does not require changes for
+configurations with `root=pipeline`.
## External elements of the bootchain (steps-scripts)
diff --git a/features/bootchain-waitdev/data/lib/bootchain/waitdev b/features/bootchain-waitdev/data/lib/bootchain/waitdev
index bc81673..60464d9 100755
--- a/features/bootchain-waitdev/data/lib/bootchain/waitdev
+++ b/features/bootchain-waitdev/data/lib/bootchain/waitdev
@@ -13,11 +13,14 @@ while [ -n "$devspec" ]; do
read -r devfile < "$envfile" ||:
if [ -n "$devfile" ]; then
- if [ ! -e "$destdir/dev" ]; then
- target="$(readlink-e "$devfile")"
+ target="$(readlink-e "$devfile" 2>/dev/null ||:)"
+
+ if [ -b "$target" ] || [ -c "$target" ]; then
+ message "target device found: $target"
+ printf '%s\n' "$target" > "$destdir/DEVNAME"
run cp -a -- "$target" "$destdir/dev"
+ break
fi
- break
fi
fi
--
2.24.1
More information about the Make-initrd
mailing list