From 5ba328cfe8310c6b0c16748427b9b246748ba204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= Date: Tue, 13 Dec 2022 10:42:30 +0100 Subject: [PATCH] Handle errors with pipe instead of process substitution --- build-images.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/build-images.sh b/build-images.sh index ae54dea..0886aa8 100755 --- a/build-images.sh +++ b/build-images.sh @@ -2,6 +2,7 @@ #!nix-shell -p nixos-generators -p nix -p coreutils -p bash -p gh -i bash # shellcheck shell=bash set -xeuo pipefail +shopt -s lastpipe build_netboot_image() { declare -r tag=$1 arch=$2 tmp=$3 @@ -38,15 +39,11 @@ main() { declare -r tag=${1:-nixos-unstable} arch=${2:-x86_64-linux} tmp="$(mktemp -d)" trap 'rm -rf -- "$tmp"' EXIT - readarray -t assets < <( + ( build_kexec_installer "$tag" "$arch" "$tmp" build_kexec_bundle "$tag" "$arch" "$tmp" build_netboot_image "$tag" "$arch" "$tmp" - ) - if [ ! "${#assets[@]}" -eq "3" ]; then - echo "Missing build asset" - exit 1 - fi + ) | readarray -t assets for asset in "${assets[@]}"; do pushd "$(dirname "$asset")" sha256sum "$(basename "$asset")" >> "$TMP/sha256sums"