Skip to content

Commit ca80d1c

Browse files
authored
Update start.sh
1 parent b836201 commit ca80d1c

File tree

1 file changed

+50
-14
lines changed

1 file changed

+50
-14
lines changed

start.sh

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,54 +33,90 @@ case "$THETA_MODE" in
3333
echo "PrivateNet setup..."
3434

3535
mkdir -p /theta/privatenet
36-
cp -r /theta/theta/integration/privatenet /theta/ || true
36+
37+
if [ ! -d "/theta/privatenet/node" ]; then
38+
echo "Copying privatenet config..."
39+
cp -r /theta/theta/integration/privatenet /theta/ || true
40+
else
41+
echo "Privatenet config already exists. Skipping copy."
42+
fi
3743

3844
mkdir -p ~/.thetacli
39-
cp -r /theta/theta/integration/privatenet/thetacli/* ~/.thetacli/ || true
40-
chmod 700 ~/.thetacli/keys/encrypted || true
45+
46+
if [ ! -d "/root/.thetacli/keys" ]; then
47+
echo "Copying CLI wallet data..."
48+
cp -r /theta/theta/integration/privatenet/thetacli/* ~/.thetacli/ || true
49+
chmod 700 ~/.thetacli/keys/encrypted || true
50+
else
51+
echo "Wallet already exists. Skipping copy."
52+
fi
4153

4254
init_wallet
4355
start_cli
4456

4557
exec theta start \
4658
--config=/theta/privatenet/node \
47-
--password-file=$PASSWORD_FILE
59+
--password="$THETA_PASSWORD"
4860
;;
4961

5062
testnet)
5163
echo "TestNet setup..."
5264

5365
mkdir -p /theta/testnet
54-
cp -r /theta/theta/integration/testnet/walletnode /theta/testnet || true
5566

56-
wget -O /theta/testnet/walletnode/snapshot \
57-
$(curl -k https://theta-testnet-backup.s3.amazonaws.com/snapshot/snapshot)
67+
if [ ! -d "/theta/testnet/walletnode" ]; then
68+
echo "Copying testnet config..."
69+
cp -r /theta/theta/integration/testnet/walletnode /theta/testnet || true
70+
else
71+
echo "Testnet config already exists. Skipping copy."
72+
fi
73+
74+
# Snapshot check
75+
if [ ! -f "/theta/testnet/walletnode/snapshot" ]; then
76+
echo "Downloading snapshot..."
77+
wget -O /theta/testnet/walletnode/snapshot \
78+
$(curl -k https://theta-testnet-backup.s3.amazonaws.com/snapshot/snapshot)
79+
else
80+
echo "Snapshot already exists. Skipping download."
81+
fi
5882

5983
init_wallet
6084
start_cli
6185

6286
exec theta start \
6387
--config=/theta/testnet/walletnode \
64-
--password-file=$PASSWORD_FILE
88+
--password="$THETA_PASSWORD"
6589
;;
6690

6791
mainnet)
6892
echo "MainNet setup..."
6993

7094
mkdir -p /theta/mainnet/walletnode
7195

72-
curl -k --output /theta/mainnet/walletnode/config.yaml \
73-
$(curl -k 'https://mainnet-data.thetatoken.org/config?is_guardian=true')
74-
75-
wget -O /theta/mainnet/walletnode/snapshot \
76-
$(curl -k https://mainnet-data.thetatoken.org/snapshot)
96+
# Config check
97+
if [ ! -f "/theta/mainnet/walletnode/config.yaml" ]; then
98+
echo "Downloading config.yaml..."
99+
curl -k --output /theta/mainnet/walletnode/config.yaml \
100+
$(curl -k 'https://mainnet-data.thetatoken.org/config?is_guardian=true')
101+
else
102+
echo "config.yaml already exists. Skipping download."
103+
fi
104+
105+
# Snapshot check
106+
if [ ! -f "/theta/mainnet/walletnode/snapshot" ]; then
107+
echo "Downloading snapshot..."
108+
wget -O /theta/mainnet/walletnode/snapshot \
109+
$(curl -k https://mainnet-data.thetatoken.org/snapshot)
110+
else
111+
echo "Snapshot already exists. Skipping download."
112+
fi
77113

78114
init_wallet
79115
start_cli
80116

81117
exec theta start \
82118
--config=/theta/mainnet/walletnode \
83-
--password-file=$PASSWORD_FILE
119+
--password="$THETA_PASSWORD"
84120
;;
85121

86122
*)

0 commit comments

Comments
 (0)