forked from cybercongress/go-cyber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
58 lines (49 loc) · 1.4 KB
/
entrypoint.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
#!/bin/sh
if [ ! -d "/root/.cyber/" ]
then
mkdir /root/.cyber/
mkdir /root/.cyber/config/
/cyber/cosmovisor/genesis/bin/cyber init ${NODE_MONIKER}
cp -r /cyber/cosmovisor/ /root/.cyber
fi
if [ ! -f "/root/.cyber/config/node_key.json" ]
then
/cyber/cosmovisor/genesis/bin/cyber init ${NODE_MONIKER}
cp /genesis.json /root/.cyber/config/
# cp /config.toml /root/.cyber/config/
cp -r /cyber/cosmovisor/ /root/.cyber
fi
# AI-DEX upgrade check
#if [ ! -d "/root/.cyber/cosmovisor/upgrades/" ]
#then
#cp -r /cyber/cosmovisor/upgrades /root/.cyber/cosmovisor
#fi
# only for testnet usage - genesis change check
if [ -f "/root/.cyber/config/genesis.json" ]
then
new_genesis=$(sha1sum /genesis.json | cut -d ' ' -f 1)
old_genesis=$(sha1sum /root/.cyber/config/genesis.json | cut -d ' ' -f 1)
wait 100
if [ $new_genesis != $old_genesis ]
then
cp /genesis.json /root/.cyber/config/
cp -r /cyber/cyber /root/.cyber/cosmovisor/genesis/bin
cyber unsafe-reset-all --home /root/.cyber
rm /root/.cyber/cosmovisor/current
fi
fi
# option to replace old binary with new binary. only for tesntet usage
if [ -f "/root/.cyber/cosmovisor/genesis/bin/cyber" ]
then
cp /cyber/cosmovisor/genesis/bin/cyber /root/.cyber/cosmovisor/genesis/bin/cyber
fi
if [ ! -f "/root/.cyber/config/genesis.json" ]
then
cp /genesis.json /root/.cyber/config/
fi
if [ "$2" = 'init' ]
then
return 0
else
exec "$@"
fi