Moving bitcoin to build role
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
# Generate bitcoin.conf
|
||||
btc_init
|
||||
|
||||
# Default / no argument invocation listens for RPC commands and has to accept non-localhost because of
|
||||
# Docker port proxying or Docker private networking.
|
||||
if [ $# -eq 0 ]; then
|
||||
# If IPv6 is in the container do both:
|
||||
#set -- '-rpcbind=[::]:8332' '-rpcallowip=::/0' '-rpcallowip=0.0.0.0/0'
|
||||
set -- '-rpcbind=:8332' '-rpcallowip=0.0.0.0/0'
|
||||
fi
|
||||
|
||||
exec bitcoind "$@"
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
# or first arg is `something.conf`
|
||||
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
|
||||
set -- btc_oneshot "$@"
|
||||
fi
|
||||
|
||||
# Allow the container to be started with `--user`, if running as root drop privileges
|
||||
if [ "$1" = 'btc_oneshot' -a "$(id -u)" = '0' ]; then
|
||||
chown -R bitcoin .
|
||||
exec gosu bitcoin "$0" "$@"
|
||||
fi
|
||||
|
||||
# If not root (i.e. docker run --user $USER ...), then run as invoked
|
||||
exec "$@"
|
||||
|
||||
Reference in New Issue
Block a user