git.iko.soy/typeable/nixpkgs
on master help sign in
fluxcd: update script fix #3
commitf8d898781a7af5378eec09f0ff268badd209f5c1 authorsuperherointj <5861043+superherointj@users.noreply.github.com> dateThu 14 Oct 2021, 14:59 (5 years ago) parenta91ebff
1 file changed+11−4
pkgs/applications/networking/cluster/fluxcd/update.sh+11−4
pkgs/applications/networking/cluster/fluxcd/update.sh+11−4
@@ -1,7 +1,7 @@
11#!/usr/bin/env nix-shell
22#!nix-shell -i bash -p curl gnugrep gnused jq
33
4−set -eu -o pipefail
4+set -x -eu -o pipefail
55
66cd $(dirname "${BASH_SOURCE[0]}")
77
@@ -14,7 +14,7 @@ SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/archi
1414SPEC_SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/releases/download/${TAG}/manifests.tar.gz)
1515
1616setKV () {
17− sed -i "s|$1 = \".*\"|$1 = \"$2\"|" ./default.nix
17+ sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix
1818}
1919
2020setKV version ${VERSION}
@@ -24,8 +24,15 @@ setKV vendorSha256 ""
2424
2525cd ../../../../../
2626set +e
27−VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd 2>&1 | grep "got:" | cut -d':' -f2 | sed 's/ //g')
27+VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd 2>&1 | grep "got:" | cut -d':' -f2 | sed 's| ||g')
2828set -e
2929
3030cd - > /dev/null
31−setKV vendorSha256 ${VENDOR_SHA256}
31+
32+if [ -n "${VENDOR_SHA256:-}" ]; then
33+ setKV vendorSha256 ${VENDOR_SHA256}
34+else
35+ echo "Update failed. VENDOR_SHA256 is empty."
36+ exit 1
37+fi
38+