robosats/docker/bitcoind/entrypoint.sh

22 lines
514 B
Bash
Raw Normal View History

2022-02-08 11:41:03 +00:00
#!/bin/sh
set -e
# Create bitcoin.conf if it doesn't exist
if [ ! -f "/home/bitcoin/.bitcoin/bitcoin.conf" ]; then
envsubst < /tmp/bitcoin.conf > /home/bitcoin/.bitcoin/bitcoin.conf
fi
_USER_ID="$(id -u)"
# Change local user id and group
if [ -n "${LOCAL_USER_ID:?}" ] && [ "$_USER_ID" != "${LOCAL_USER_ID:?}" ]; then
usermod -u "${LOCAL_USER_ID:?}" bitcoin
fi
groupmod -g "${LOCAL_GROUP_ID:?}" bitcoin
# Fix ownership
chown -R bitcoin /home/bitcoin
# Run original entrypoint
exec /entrypoint.sh "$@"