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 <maksim.malchuk@gmail.com>
This commit is contained in:
Maksim Malchuk 2023-08-30 14:04:13 +03:00
parent 9b931852f7
commit 0322695a5e
1 changed files with 2 additions and 2 deletions

View File

@ -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..."