forked from Chia-Network/chia-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·51 lines (41 loc) · 1.25 KB
/
docker-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
#!/usr/bin/env bash
# shellcheck disable=SC2154
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 || exit 1
# shellcheck disable=SC1091
. ./activate
chia init --fix-ssl-permissions
if [[ ${testnet} == 'true' ]]; then
echo "configure testnet"
chia configure --testnet true
fi
if [[ ${keys} == "persistent" ]]; then
echo "Not touching key directories"
elif [[ ${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
if [[ -n "${log_level}" ]]; then
chia configure --log-level "${log_level}"
fi
sed -i 's/localhost/127.0.0.1/g' "$CHIA_ROOT/config/config.yaml"
exec "$@"