-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathdill.sh
73 lines (63 loc) · 2.31 KB
/
dill.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
#!/bin/bash
_ROOT="$(pwd)" && cd "$(dirname "$0")" && ROOT="$(pwd)"
PJROOT="$ROOT"
DILL_DIR="$PJROOT/dill"
download=1
if [ $# -ge 1 ];then
download=$1
fi
version="v1.0.4"
function launch_dill() {
# Ask for OS type
os_type=$(uname) # Darwin or Linux
chip=$(uname -m)
dill_darwin_file="dill-$version-darwin-arm64.tar.gz"
dill_linux_file="dill-$version-linux-amd64.tar.gz"
DILL_DARWIN_ARM64_URL="https://dill-release.s3.ap-southeast-1.amazonaws.com/$version/$dill_darwin_file"
DILL_LINUX_AMD64_URL="https://dill-release.s3.ap-southeast-1.amazonaws.com/$version/$dill_linux_file"
if [ "$os_type" == "Darwin" ];then
if [ "$chip" == "arm64" ];then
echo "Supported, os_type: $os_type, chip: $chip"
if [ "$download" != "0" ];then
curl -O $DILL_DARWIN_ARM64_URL
tar -zxvf $dill_darwin_file
fi
else
echo "Unsupported, os_type: $os_type, chip: $chip"
exit 1
fi
else
if [ "$chip" == "x86_64" ] && [ -f /etc/os-release ];then
if ! grep -qi "flags.*:.*adx" /proc/cpuinfo; then
echo "Warn: The cpu lacks the required instruction set extension (adx) and may not run properly."
echo "But you can also try. Press any key to continue..."
read -n 1 -s -r
fi
source /etc/os-release
if [ "$ID" == "ubuntu" ];then
major_version=$(echo $VERSION_ID | cut -d. -f1)
if [ $major_version -ge 20 ]; then
echo "Supported, os: $ID $VERSION_ID, chip: $chip"; echo""
if [ "$download" != "0" ];then
curl -O $DILL_LINUX_AMD64_URL
tar -zxvf $dill_linux_file
fi
else
echo "Unsupported, os: $ID $VERSION_ID (ubuntu 20.04+ required)"
exit 1
fi
else
echo "Unsupported, os_type: $os_type, chip: $chip, $ID $VERSION_ID"
exit 1
fi
else
echo "Unsupported, os_type: $os_type, chip: $chip"
exit 1
fi
fi
$DILL_DIR/1_launch_dill_node.sh
}
function add_validator() {
$DILL_DIR/2_add_validator.sh
}
launch_dill