forked from keep-network/local-setup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-keep-ecdsa.sh
executable file
·63 lines (43 loc) · 1.94 KB
/
install-keep-ecdsa.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
#!/bin/bash
set -e
LOG_START='\n\e[1;36m' # new line + bold + color
LOG_END='\n\e[0m' # new line + reset color
DONE_START='\n\e[1;32m' # new line + bold + green
DONE_END='\n\n\e[0m' # new line + reset
WORKDIR=$PWD
printf "${LOG_START}Starting keep-ecdsa deployment...${LOG_END}"
printf "${LOG_START}Copying config files...${LOG_END}"
# Copy all config files to the right keep-ecdsa directory.
cp -R configs/keep-ecdsa/. keep-ecdsa/configs/
cd keep-ecdsa/configs
# Fill absolute paths in config files with actual working directory.
TMP_FILE=$(mktemp /tmp/config.local.1.toml.XXXXXXXXXX)
sed 's:WORKDIR:'$WORKDIR':' config.local.1.toml > $TMP_FILE
mv $TMP_FILE config.local.1.toml
TMP_FILE=$(mktemp /tmp/config.local.2.toml.XXXXXXXXXX)
sed 's:WORKDIR:'$WORKDIR':' config.local.2.toml > $TMP_FILE
mv $TMP_FILE config.local.2.toml
TMP_FILE=$(mktemp /tmp/config.local.3.toml.XXXXXXXXXX)
sed 's:WORKDIR:'$WORKDIR':' config.local.3.toml > $TMP_FILE
mv $TMP_FILE config.local.3.toml
printf "${LOG_START}Creating storage directories...${LOG_END}"
cd $WORKDIR
# Create storage directories for keep-ecdsa clients.
mkdir -p storage/keep-ecdsa/1
mkdir -p storage/keep-ecdsa/2
mkdir -p storage/keep-ecdsa/3
printf "${LOG_START}Updating keep-ecdsa configuration...${LOG_END}"
# Set correct Geth WS port.
cd keep-ecdsa/solidity
TMP_FILE=$(mktemp /tmp/truffle.js.XXXXXXXXXX)
sed -e 's/\port\:.*/\port\: '8546,'/g;s/\websockets\:.*/\websockets\: 'true,'/g' truffle.js > $TMP_FILE
mv $TMP_FILE truffle.js
cd ..
printf "${LOG_START}Running install script...${LOG_END}"
# Run keep-ecdsa install script. Answer with ENTER twice on emerging prompts.
printf '\n\n' | ./scripts/install.sh
printf "${LOG_START}Updating keep-ecdsa node_modules...${LOG_END}"
cd $WORKDIR
rm -rf keep-ecdsa/solidity/node_modules/@keep-network/keep-core
cp -R keep-core/solidity/. keep-ecdsa/solidity/node_modules/@keep-network/keep-core
printf "${DONE_START}keep-ecdsa deployed successfully!${DONE_END}"