forked from ton-blockchain/ton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare.sh
executable file
·41 lines (34 loc) · 1.44 KB
/
prepare.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
#!/bin/bash
host=$1
user="root"
ssh=$user@$host
die() {
echo "$@" 1>&2 ;
exit 1;
}
run_help() {
echo "tries to initialize new server"
echo "uses these files: "
echo " tonkey - RSA key that allows to access git repository"
echo " server-list - list of core DHT servers"
echo " server-list.local - list of additional servers"
die
}
if [ "$1" == "-h" ] ; then
run_help
fi
if [ "$1" == "--help" ] ; then
run_help
fi
scp tonkey $ssh:.ssh/id_rsa || die "cannot copy id_rsa"
ssh $ssh chmod 0600 .ssh/id_rsa || die "cannot chmod id_rsa"
scp known_hosts $ssh:.ssh/known_hosts || die "cannot copy known_hosts"
ssh $ssh "apt-get update && apt-get -y install git libssl-dev cmake g++ gperf libz-dev" || die "cannot install packets"
ssh $ssh "git clone [email protected]:toin/ton.git ; cd ton && git submodule init ; git submodule update && cd third-party/libraptorq && git submodule init && git submodule update" || die "cannot clone git"
ssh $ssh "cd ton && git submodule update" || die "can not init submodules"
ssh $ssh "if [ ! -d ton-build ]; then mkdir ton-build ; fi"
ssh $ssh "cd ton-build && cmake ../ton" || die "cannot prepare for build"
ssh $ssh "cd ton-build && make -j 8 test-node" || die "cannot build"
sh generate-config.sh global ton-global.config.json || die "cannot create global config"
sh generate-config.sh local $host ton-local.config.json || die "cannot create local config"
scp ton-global.config.json ton-local.config.json $ssh: