public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] expand-on-first-boot: Fix "label: gpt" detection
@ 2024-05-29 12:09 Uladzimir Bely
  2024-06-03  6:38 ` Uladzimir Bely
  0 siblings, 1 reply; 2+ messages in thread
From: Uladzimir Bely @ 2024-05-29 12:09 UTC (permalink / raw)
  To: isar-users

Commit 991d2e9 introduced the issue when the whole script early exits
(due to "set -x") in case grep doesn't find the pattern and produces
an error code.

In this case last partition remains non-expanded.

Fix this by masking error with "echo 0".

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 .../expand-on-first-boot/files/expand-last-partition.sh         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 0cb2ee21..8ab0f8f0 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
@@ -41,7 +41,7 @@ if [ "$DISK_SIZE" -lt "$MINIMAL_SIZE" ]; then
 	exit 0
 fi
 
-IS_GPT="$(sfdisk -d "${BOOT_DEV}" 2>/dev/null | grep -q "label: gpt" && echo 1)"
+IS_GPT="$(sfdisk -d "${BOOT_DEV}" 2>/dev/null | grep -q "label: gpt" && echo 1 || echo 0)"
 if [ "$IS_GPT" = "1" ]; then
 	dd if="${BOOT_DEV}" of=/dev/shm/__mbr__.bak count=1
 fi
-- 
2.44.1


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

* Re: [PATCH] expand-on-first-boot: Fix "label: gpt" detection
  2024-05-29 12:09 [PATCH] expand-on-first-boot: Fix "label: gpt" detection Uladzimir Bely
@ 2024-06-03  6:38 ` Uladzimir Bely
  0 siblings, 0 replies; 2+ messages in thread
From: Uladzimir Bely @ 2024-06-03  6:38 UTC (permalink / raw)
  To: isar-users

On Wed, 2024-05-29 at 15:09 +0300, Uladzimir Bely wrote:
> Commit 991d2e9 introduced the issue when the whole script early exits
> (due to "set -x") in case grep doesn't find the pattern and produces
> an error code.
> 
> In this case last partition remains non-expanded.
> 
> Fix this by masking error with "echo 0".
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  .../expand-on-first-boot/files/expand-last-partition.sh         | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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 0cb2ee21..8ab0f8f0 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
> @@ -41,7 +41,7 @@ if [ "$DISK_SIZE" -lt "$MINIMAL_SIZE" ]; then
>  	exit 0
>  fi
>  
> -IS_GPT="$(sfdisk -d "${BOOT_DEV}" 2>/dev/null | grep -q "label: gpt"
> && echo 1)"
> +IS_GPT="$(sfdisk -d "${BOOT_DEV}" 2>/dev/null | grep -q "label: gpt"
> && echo 1 || echo 0)"
>  if [ "$IS_GPT" = "1" ]; then
>  	dd if="${BOOT_DEV}" of=/dev/shm/__mbr__.bak count=1
>  fi
> -- 
> 2.44.1
> 

Applied to next.

-- 
Best regards,
Uladzimir.




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

end of thread, other threads:[~2024-06-03  6:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-29 12:09 [PATCH] expand-on-first-boot: Fix "label: gpt" detection Uladzimir Bely
2024-06-03  6:38 ` Uladzimir Bely

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