Skip to content

Commit 433c423

Browse files
committed
feat: add update.sh script to teku
1 parent e5851a2 commit 433c423

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

pkgs/teku/update.sh

100644100755
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env nix-shell
22
#!nix-shell -i bash -p curl jq nix sd
33

4-
set -e
4+
set -ex
55

66
dirname="$(dirname "$0")"
77
rootDir="$(git -C "$dirname" rev-parse --show-toplevel)"
@@ -15,19 +15,13 @@ updateVersion() {
1515
updateHash() {
1616
local version=$1
1717
local url="https://artifacts.consensys.net/public/${pname}/raw/names/${pname}.tar.gz/versions/${version}/${pname}-${version}.tar.gz"
18-
19-
local output=$(nix store prefetch-file --json "$url")
20-
local sriHash=$(echo "$output" | jq -r .hash)
21-
22-
sd "\"hash\" = \"[a-zA-Z0-9\/+-=]*\";" "\"hash\" = \"$sriHash\";" "${dirname}/default.nix"
18+
local sriHash=$(nix store prefetch-file --json "$url" | jq -r '.hash')
19+
sd 'hash = "[a-zA-Z0-9/+-=]*";' "hash = \"$sriHash\";" "${dirname}/default.nix"
2320
}
2421

25-
currentVersion=$(nix show-derivation "${rootDir}#${pname}" | jq -r '.[].env.version')
22+
currentVersion=$(nix derivation show "${rootDir}#${pname}" | jq -r '.[].env.version')
2623
latestVersion=$(curl -s "https://api.github.com/repos/ConsenSys/teku/releases/latest" | jq -r '.tag_name')
2724

28-
# Optionally strip leading 'v' if present in the tag name
29-
latestVersion=${latestVersion#v}
30-
3125
if [[ "$currentVersion" == "$latestVersion" ]]; then
3226
echo "${pname} is up to date: ${currentVersion}"
3327
exit 0

0 commit comments

Comments
 (0)