35 lines
		
	
	
		
			721 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			721 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| export HOME="/var/lib/bitcoind"
 | |
| 
 | |
| # gen random pw for rpc server
 | |
| RANDOMPW=$(openssl rand -hex 10)
 | |
| 
 | |
| cat <<EOF > $HOME/bitcoin.conf
 | |
| rpcuser=${BITCOIND_RPCUSER:-rpcuser}
 | |
| rpcpassword=${BITCOIND_RPCPASSWORD:-$RANDOMPW}
 | |
| EOF
 | |
| 
 | |
| # SECURITY this puts the rpc password into the container log
 | |
| cat $HOME/bitcoin.conf
 | |
| 
 | |
| ARGS=""
 | |
| ARGS+=" -printtoconsole"
 | |
| ARGS+=" -disablewallet"
 | |
| ARGS+=" -datadir=$HOME"
 | |
| ARGS+=" -conf=$HOME/bitcoin.conf"
 | |
| ARGS+=" -rpcallowip=::/0"
 | |
| 
 | |
| if [[ ! -d $HOME/blocks ]]; then
 | |
|     if [[ -e /var/lib/bootstrap.dat ]]; then
 | |
|         ARGS+=" -loadblock=/var/lib/bootstrap.dat"
 | |
|     fi
 | |
| fi
 | |
| 
 | |
| chown -R bitcoind:bitcoind $HOME
 | |
| 
 | |
| exec chpst -ubitcoind \
 | |
|     bitcoind $ARGS \
 | |
|         $BITCOIND_EXTRA_OPTS \
 | |
|         2>&1
 |