public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] expand-on-first-boot: Resolve errors in helper script
@ 2022-05-24 19:00 Jan Kiszka
  2022-05-25  8:08 ` Henning Schild
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2022-05-24 19:00 UTC (permalink / raw)
  To: isar-users; +Cc: Moessbauer, Felix (T CED SES-DE)

From: Jan Kiszka <jan.kiszka@siemens.com>

Missing quotes broke the -n test, and as we are at it, also resolve the
shellcheck warnings.

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..8a8b7c98 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/* 2>/dev/null | head -1)
+if [ -n "${ROOT_DEV_SLAVE}" ]; then
 	ROOT_DEV=/dev/${ROOT_DEV_SLAVE##*/}
 fi
 
-- 
2.35.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] expand-on-first-boot: Resolve errors in helper script
  2022-05-24 19:00 [PATCH] expand-on-first-boot: Resolve errors in helper script Jan Kiszka
@ 2022-05-25  8:08 ` Henning Schild
  0 siblings, 0 replies; 2+ messages in thread
From: Henning Schild @ 2022-05-25  8:08 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: isar-users, Moessbauer, Felix (T CED SES-DE)

Am Tue, 24 May 2022 21:00:03 +0200
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Missing quotes broke the -n test, and as we are at it, also resolve
> the shellcheck warnings.
> 
> 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..8a8b7c98 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/* 2>/dev/null | head -1)

maybe 
  find /sys/block/${ROOT_DEV_NAME}/slaves/ -mindepth 1 -print -quit

 -mindepth 1 to loose the *
 -print -quit to loose the pipe head 1

Henning 

> +if [
> -n "${ROOT_DEV_SLAVE}" ]; then ROOT_DEV=/dev/${ROOT_DEV_SLAVE##*/}
>  fi
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-25  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 19:00 [PATCH] expand-on-first-boot: Resolve errors in helper script Jan Kiszka
2022-05-25  8:08 ` Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox