forked from Chia-Network/chia-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
58 lines (49 loc) · 1.49 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
if [[ -n "${TZ}" ]]; then
echo "Setting timezone to ${TZ}"
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
fi
cd /chia-blockchain
. ./activate
chia init
if [[ ${keys} == "generate" ]]; then
echo "to use your own keys pass them as a text file -v /path/to/keyfile:/path/in/container and -e keys=\"/path/in/container\""
chia keys generate
elif [[ ${keys} == "copy" ]]; then
if [[ -z ${ca} ]]; then
echo "A path to a copy of the farmer peer's ssl/ca required."
exit
else
chia init -c ${ca}
fi
else
chia keys add -f ${keys}
fi
for p in ${plots_dir//:/ }; do
mkdir -p ${p}
if [[ ! "$(ls -A $p)" ]]; then
echo "Plots directory '${p}' appears to be empty, try mounting a plot directory with the docker -v command"
fi
chia plots add -d ${p}
done
sed -i 's/localhost/127.0.0.1/g' ~/.chia/mainnet/config/config.yaml
if [[ ${farmer} == 'true' ]]; then
chia start farmer-only
elif [[ ${harvester} == 'true' ]]; then
if [[ -z ${farmer_address} || -z ${farmer_port} || -z ${ca} ]]; then
echo "A farmer peer address, port, and ca path are required."
exit
else
chia configure --set-farmer-peer ${farmer_address}:${farmer_port}
chia start harvester
fi
else
chia start farmer
fi
if [[ ${testnet} == "true" ]]; then
if [[ -z $full_node_port || $full_node_port == "null" ]]; then
chia configure --set-fullnode-port 58444
else
chia configure --set-fullnode-port ${var.full_node_port}
fi
fi
while true; do sleep 30; done;