From 0322695a5e509f524e6b333c48d5d6b512b73ce4 Mon Sep 17 00:00:00 2001 From: Maksim Malchuk Date: Wed, 30 Aug 2023 14:04:13 +0300 Subject: [PATCH] Fix and issue with wait_for Followup I2dd1c60e3bfd9c823a7382b1390b1d40c52a5c97. The 'wait_for' array always updated even the command not executed after test because of '&' control operator, so lets wrap construction in standard 'if..then' case instead of using '&&' control operator. Change-Id: I1d1ecb05e61f3995a98de450705451b94b437a08 Signed-off-by: Maksim Malchuk --- diskimage_builder/lib/common-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diskimage_builder/lib/common-functions b/diskimage_builder/lib/common-functions index 262094f7..0fc49729 100644 --- a/diskimage_builder/lib/common-functions +++ b/diskimage_builder/lib/common-functions @@ -75,8 +75,8 @@ function finish_image () { # workaround ... declare -a wait_for [[ "$DIB_CHECKSUM" == "1" ]] && DIB_CHECKSUM="md5,sha256" - [[ "$DIB_CHECKSUM" == *md5* ]] && md5sum $1 > $1.md5 & wait_for+=($!) - [[ "$DIB_CHECKSUM" == *sha256* ]] && sha256sum $1 > $1.sha256 & wait_for+=($!) + if [[ "$DIB_CHECKSUM" == *md5* ]]; then md5sum $1 > $1.md5 & wait_for+=($!); fi + if [[ "$DIB_CHECKSUM" == *sha256* ]]; then sha256sum $1 > $1.sha256 & wait_for+=($!); fi wait "${wait_for[@]}" fi echo "Image file $1 created..."