-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_remote.sh
executable file
·64 lines (52 loc) · 1.23 KB
/
setup_remote.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
#!/bin/bash
CODE_URL="https://github.com/iotexproject/iotex-pantheon/archive/master.zip"
TMP_DIR="/tmp/.iotex/pantheon/"
UNZIP="unzip"
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
function checkDockerPermissions() {
docker ps > /dev/null
if [ $? = 1 ];then
echo -e "your $RED [$USER] $NC not privilege docker"
echo -e "please run $RED [sudo bash] $NC first"
echo -e "Or docker not install "
exit 1
fi
}
function checkDockerCompose() {
docker-compose --version > /dev/null 2>&1
if [ $? -eq 127 ];then
echo -e "$RED docker-compose command not found $NC"
echo -e "Please install it first"
exit 1
fi
}
function checkCommandUnzip() {
unzip -v > /dev/null 2>&1
if [ $? -ne 0 ];then
echo -e "$RED unzip command not found $NC"
echo -e "Please install it first"
exit 1
fi
}
function fetchCode() {
mkdir -p $TMP_DIR
curl -sSL $CODE_URL > $TMP_DIR/master.zip
pushd $TMP_DIR
$UNZIP master.zip
popd
}
function main() {
checkDockerPermissions
checkDockerCompose
checkCommandUnzip
fetchCode
pushd $TMP_DIR/iotex-pantheon-master
./setup.sh
popd
}
main $@