forked from ruimarinho/docker-bitcoin-core
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
39 lines (29 loc) · 753 Bytes
/
Copy pathentrypoint.sh
File metadata and controls
39 lines (29 loc) · 753 Bytes
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
#!/bin/bash
set -e
if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then
usermod -u "$UID" bitcoin
fi
if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then
groupmod -g "$GID" bitcoin
fi
[ "$#" -eq 0 ] && set -- bitcoind
case "${1:-}" in
-*)
set -- bitcoind "$@"
;;
esac
if [ "${1:-}" = "bitcoind" ]; then
mkdir -p "$BITCOIN_DATA"
chmod 700 "$BITCOIN_DATA"
# Fix permissions for home dir.
chown -R bitcoin:bitcoin "$(getent passwd bitcoin | cut -d: -f6)"
# Fix permissions for bitcoin data dir.
chown -R bitcoin:bitcoin "$BITCOIN_DATA"
set -- "$@" -datadir="$BITCOIN_DATA"
fi
if [ "${1:-}" = "bitcoind" ] || [ "${1:-}" = "bitcoin-cli" ] || [ "${1:-}" = "bitcoin-tx" ]; then
echo
exec gosu bitcoin "$@"
fi
echo
exec "$@"