-
Notifications
You must be signed in to change notification settings - Fork 13
/
install.sh
executable file
·60 lines (51 loc) · 1.58 KB
/
install.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
#!/bin/sh
# adopted from https://github.com/denoland/deno_install/blob/master/install.sh
set -e
ext="tar.gz"
extract() {
if [ "$ext" = "tar.gz" ]; then
tar -xvf $1 -C $2
else
unzip -d $2 -o $1
fi
}
if [ "$OS" = "Windows_NT" ]; then
target="x86_64-pc-windows-msvc"
ext="zip"
if ! command -v unzip >/dev/null; then
echo "Error: unzip is required to install Webb Relayer." 1>&2
exit 1
fi
else
case $(uname -sm) in
"Darwin x86_64") target="x86_64-apple-darwin" ;;
"Darwin arm64") target="aarch64-apple-darwin" ;;
*) target="x86_64-unknown-linux-musl" ;;
esac
fi
if [ $# -eq 0 ]; then
relayer_uri="https://github.com/webb-tools/relayer/releases/latest/download/webb-relayer-${target}.${ext}"
else
relayer_uri="https://github.com/webb-tools/relayer/releases/download/${1}/webb-relayer-${target}.${ext}"
fi
relayer_install=$HOME/.webb
exe="$relayer_install/webb-relayer"
if [ ! -d "$relayer_install" ]; then
mkdir -p "$relayer_install"
fi
curl --fail --location --progress-bar --output "$exe.zip" "$relayer_uri"
extract "$exe.zip" "$relayer_install"
chmod +x "$exe"
rm "$exe.zip"
echo "Webb Relayer was installed successfully to $exe"
if command -v webb-relayer >/dev/null; then
echo "Run 'webb-relayer --help' to get started"
else
case $SHELL in
/bin/zsh) shell_profile=".zshrc" ;;
*) shell_profile=".bash_profile" ;;
esac
echo "Manually add the directory to your \$HOME/$shell_profile (or similar)"
echo " export PATH=\"\$HOME/.webb/:\$PATH\""
echo "Run '$exe --help' to get started"
fi