forked from evaluationcopy/dogecoin-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
41 lines (30 loc) · 997 Bytes
/
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
#!/bin/bash
set -e
if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then
usermod -u "$UID" dogecoin
fi
if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then
groupmod -g "$GID" dogecoin
fi
echo "$0: assuming uid:gid for dogecoin:dogecoin of $(id -u dogecoin):$(id -g dogecoin)"
if [ $(echo "$1" | cut -c1) = "-" ]; then
echo "$0: assuming arguments for dogecoind"
set -- dogecoind "$@"
fi
if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "dogecoind" ]; then
mkdir -p "$DOGECOIN_DATA"
chmod 700 "$DOGECOIN_DATA"
# Fix permissions for home dir.
chown -R dogecoin:dogecoin "$(getent passwd dogecoin | cut -d: -f6)"
# Fix permissions for bitcoin data dir.
chown -R dogecoin:dogecoin "$DOGECOIN_DATA"
echo "$0: setting data directory to $DOGECOIN_DATA"
set -- "$@" -datadir="$DOGECOIN_DATA"
fi
if [ "$1" = "dogecoind" ] || [ "$1" = "dogecoin-cli" ] || [ "$1" = "dogecoin-tx" ]; then
echo
exec gosu dogecoin "$@"
fi
chown -R dogecoin:dogecoin "$DOGECOIN_DATA"
echo
exec "$@"