forked from jito-foundation/jito-solana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolana-install-deploy.sh
executable file
·79 lines (69 loc) · 1.72 KB
/
solana-install-deploy.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
#
# Convenience script to easily deploy a software update to a testnet
#
set -e
SOLANA_ROOT="$(cd "$(dirname "$0")"/..; pwd)"
maybeKeypair=
while [[ ${1:0:2} = -- ]]; do
if [[ $1 = --keypair && -n $2 ]]; then
maybeKeypair="$1 $2"
shift 2
else
echo "Error: Unknown option: $1"
exit 1
fi
done
URL=$1
TAG=$2
OS=${3:-linux}
if [[ -z $URL || -z $TAG ]]; then
echo "Usage: $0 [stable|localhost|RPC URL] [edge|beta|release tag] [linux|osx|windows]"
exit 0
fi
if [[ ! -f update_manifest_keypair.json ]]; then
"$SOLANA_ROOT"/scripts/solana-install-update-manifest-keypair.sh "$OS"
fi
case "$OS" in
osx)
TARGET=x86_64-apple-darwin
;;
linux)
TARGET=x86_64-unknown-linux-gnu
;;
windows)
TARGET=x86_64-pc-windows-msvc
;;
*)
TARGET=unknown-unknown-unknown
;;
esac
case $URL in
stable)
URL=http://api.devnet.solana.com
;;
localhost)
URL=http://localhost:8899
;;
*)
;;
esac
case $TAG in
edge|beta)
DOWNLOAD_URL=https://release.jito.wtf/"$TAG"/solana-release-$TARGET.tar.bz2
;;
*)
DOWNLOAD_URL=https://github.com/jito-foundation/jito-solana/releases/download/"$TAG"/solana-release-$TARGET.tar.bz2
;;
esac
# Prefer possible `cargo build` binaries over PATH binaries
PATH="$SOLANA_ROOT"/target/debug:$PATH
set -x
# shellcheck disable=SC2086 # Don't want to double quote $maybeKeypair
balance=$(solana $maybeKeypair --url "$URL" balance --lamports)
if [[ $balance = "0 lamports" ]]; then
# shellcheck disable=SC2086 # Don't want to double quote $maybeKeypair
solana $maybeKeypair --url "$URL" airdrop 0.000000042
fi
# shellcheck disable=SC2086 # Don't want to double quote $maybeKeypair
solana-install deploy $maybeKeypair --url "$URL" "$DOWNLOAD_URL" update_manifest_keypair.json