From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: "Moessbauer, Felix (T CED SES-DE)" <felix.moessbauer@siemens.com>,
Henning Schild <henning.schild@siemens.com>
Subject: [PATCH v2] expand-on-first-boot: Resolve errors in helper script
Date: Wed, 25 May 2022 14:26:50 +0200 [thread overview]
Message-ID: <cd4c82ac-164a-cf9b-cdc4-3f6bfc321eb8@siemens.com> (raw)
From: Jan Kiszka <jan.kiszka@siemens.com>
Missing quotes broke the -n test, and as we are at it, also resolve the
shellcheck warnings and consolidate over 'find' for retrieving
ROOT_DEV_SLAVE.
Fixes: 15214487e19e ("expand-on-first-boot: Add support for devicemapper")
Reported-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../expand-on-first-boot/files/expand-last-partition.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
index bb371e9f..f3e29a1c 100755
--- a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
+++ b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
@@ -11,8 +11,8 @@ set -e
ROOT_DEV="$(findmnt / -o source -n)"
ROOT_DEV_NAME=${ROOT_DEV##*/}
-ROOT_DEV_SLAVE=$(ls -d /sys/block/${ROOT_DEV_NAME}/slaves/* 2>/dev/null | head -1)
-if [ -n ${ROOT_DEV_SLAVE} ]; then
+ROOT_DEV_SLAVE=$(find /sys/block/"${ROOT_DEV_NAME}"/slaves -mindepth 1 -print -quit 2>/dev/null)
+if [ -n "${ROOT_DEV_SLAVE}" ]; then
ROOT_DEV=/dev/${ROOT_DEV_SLAVE##*/}
fi
--
2.35.3
next reply other threads:[~2022-05-25 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 12:26 Jan Kiszka [this message]
2022-06-02 11:27 ` Anton Mikanovich
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=cd4c82ac-164a-cf9b-cdc4-3f6bfc321eb8@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=felix.moessbauer@siemens.com \
--cc=henning.schild@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