make shellcheck happy

This commit is contained in:
Jörg Thalheim 2021-06-10 09:30:10 +02:00
parent 007095bbcb
commit b8510c4f46
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4

View file

@ -1,29 +1,26 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -p nix -p coreutils -p bash -p gh -i bash #!nix-shell -p nix -p coreutils -p bash -p gh -i bash
# shellcheck shell=bash
set -xeuo pipefail set -xeuo pipefail
build_netboot_image() { build_netboot_image() {
tag=$1 declare -r tag=$1 arch=$2 tmp=$3
arch=$2
tmp=$3
img=$(nix-build --no-out-link -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" '<nixpkgs/nixos/release.nix>' -A "netboot.$arch") img=$(nix-build --no-out-link -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" '<nixpkgs/nixos/release.nix>' -A "netboot.$arch")
cp "$(readlink $img/bzImage)" "$tmp/bzImage-$arch" cp "$(readlink "$img/bzImage")" "$tmp/bzImage-$arch"
echo "$tmp/bzImage-$arch" echo "$tmp/bzImage-$arch"
cp "$(readlink $img/initrd)" "$tmp/initrd-$arch" cp "$(readlink "$img/initrd")" "$tmp/initrd-$arch"
echo "$tmp/initrd-$arch" echo "$tmp/initrd-$arch"
} }
main() { main() {
tag=${1:-nixos-unstable} declare -r tag=${1:-nixos-unstable} arch=${2:-x86_64-linux}
arch=${2:-x86_64-linux}
sha256s=()
tmp="$(mktemp -d)" tmp="$(mktemp -d)"
trap 'rm -rf -- "$tmp"' EXIT trap 'rm -rf -- "$tmp"' EXIT
assets=($(build_netboot_image "$tag" "$arch" "$tmp")) readarray -t assets < <(build_netboot_image "$tag" "$arch" "$tmp")
for asset in "${assets[@]}"; do for asset in "${assets[@]}"; do
pushd "$(dirname $asset)" pushd "$(dirname "$asset")"
sha256sum "$(basename $asset)" >> "$TMP/sha256sums" sha256sum "$(basename "$asset")" >> "$TMP/sha256sums"
popd popd
done done
assets+=("$TMP/sha256sums") assets+=("$TMP/sha256sums")