fluxcd: update script fix #3

This commit is contained in:
superherointj 2021-10-14 14:59:33 -03:00
parent a91ebff981
commit f8d898781a

View file

@ -1,7 +1,7 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnugrep gnused jq
set -eu -o pipefail
set -x -eu -o pipefail
cd $(dirname "${BASH_SOURCE[0]}")
@ -14,7 +14,7 @@ SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/archi
SPEC_SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/releases/download/${TAG}/manifests.tar.gz)
setKV () {
sed -i "s|$1 = \".*\"|$1 = \"$2\"|" ./default.nix
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix
}
setKV version ${VERSION}
@ -24,8 +24,15 @@ setKV vendorSha256 ""
cd ../../../../../
set +e
VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd 2>&1 | grep "got:" | cut -d':' -f2 | sed 's/ //g')
VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd 2>&1 | grep "got:" | cut -d':' -f2 | sed 's| ||g')
set -e
cd - > /dev/null
setKV vendorSha256 ${VENDOR_SHA256}
if [ -n "${VENDOR_SHA256:-}" ]; then
setKV vendorSha256 ${VENDOR_SHA256}
else
echo "Update failed. VENDOR_SHA256 is empty."
exit 1
fi