-
Notifications
You must be signed in to change notification settings - Fork 12
/
updateTeku.sh
executable file
·62 lines (50 loc) · 1.51 KB
/
updateTeku.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -euo pipefail
TEMP=`mktemp -d`
function cleanup() {
rm -rf "${TEMP}"
}
trap cleanup EXIT
VERSION=${1?Must specify the Teku version to get}
URL="https://artifacts.consensys.net/public/teku/raw/names/teku.zip/versions/${VERSION}/teku-${VERSION}.zip"
echo "Downloading version ${VERSION} of Teku from ${URL}..."
curl -o "${TEMP}/teku-${VERSION}.zip" -L --fail "${URL}"
unzip -t "${TEMP}/teku-${VERSION}.zip"
echo "Calculating new hash..."
HASH=`shasum -a 256 ${TEMP}/teku-${VERSION}.zip | cut -d ' ' -f 1`
cat > teku.rb <<EOF
class Teku < Formula
desc "Teku Ethereum 2 beacon chain client"
homepage "https://github.com/consensys/teku"
url "${URL}"
# update with: ./updateTeku.sh <new-version>
sha256 "${HASH}"
head "https://artifacts.consensys.net/public/teku/raw/names/teku.zip/versions/develop/teku-develop.zip"
depends_on "openjdk" => "21+"
def install
cp_r ".", "#{prefix}/dist"
bin.install_symlink "#{prefix}/dist/bin/teku"
(buildpath/"teku.yaml").write <<~EOS
# Default Homebrew Teku config
network: "mainnet"
data-path: "#{etc}/teku.yaml"
EOS
etc.install "teku.yaml"
end
def post_install
# Make sure the var/teku directory exists
(var/"teku").mkpath
end
service do
run [opt_bin/"teku", "--config-file=#{etc}/teku.yaml"]
keep_alive true
working_dir var/"teku"
end
test do
system "#{bin}/teku" "--version"
end
end
EOF
echo "New url: ${URL}"
echo "New hash: ${HASH}"
echo "Success. Commit the changes to teku.rb to release."