From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,MISSING_DATE,MISSING_MID, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 From: "Leonid Krivoshein" To: make-initrd@lists.altlinux.org Subject: [make-initrd] [PATCH v6 06/22] bootchain-waitdev: improving the logic of the step X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Sun, 24 Oct 2021 17:20:46 -0000 X-List-Received-Date: Sun, 24 Oct 2021 17:20:46 -0000 Message-ID: <20211024172046.qSiFtQ0aHEdTEKTXSAc-cL8Ctu1MW5JcYheTggkIsb8@z> Archived-At: List-Archive: 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 --- 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