mynode/rootfs/standard/usr/bin/mynode_gen_bitcoin_config.sh

34 lines
1.2 KiB
Bash
Raw Normal View History

2019-11-04 04:50:47 +00:00
#!/bin/bash
2020-01-29 01:59:46 +00:00
# Setup default settings
if [ ! -f /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled_defaulted ]; then
touch /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled_defaulted
touch /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled
sync
fi
2019-11-04 04:50:47 +00:00
# Generate BTC Config
2019-11-05 01:34:19 +00:00
if [ -f /mnt/hdd/mynode/settings/bitcoin_custom.conf ]; then
2020-01-29 01:59:46 +00:00
# Use Custom Config
2019-11-05 01:34:19 +00:00
cp -f /mnt/hdd/mynode/settings/bitcoin_custom.conf /mnt/hdd/mynode/bitcoin/bitcoin.conf
else
2020-01-29 01:59:46 +00:00
# Generate a default config
2019-11-05 01:34:19 +00:00
cp -f /usr/share/mynode/bitcoin.conf /mnt/hdd/mynode/bitcoin/bitcoin.conf
2020-01-29 01:59:46 +00:00
# Append other sections
if [ -f /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled ]; then
cat /usr/share/mynode/bitcoin_tor.conf >> /mnt/hdd/mynode/bitcoin/bitcoin.conf
else
cat /usr/share/mynode/bitcoin_ipv4.conf >> /mnt/hdd/mynode/bitcoin/bitcoin.conf
fi
2019-11-05 01:34:19 +00:00
fi
2019-11-04 04:50:47 +00:00
PW=$(cat /mnt/hdd/mynode/settings/.btcrpcpw)
RPCAUTH=$(gen_rpcauth.py mynode $PW)
#sed -i "s/rpcpassword=.*/rpcpassword=$PW/g" /mnt/hdd/mynode/bitcoin/bitcoin.conf
sed -i "s/rpcauth=.*/$RPCAUTH/g" /mnt/hdd/mynode/bitcoin/bitcoin.conf
cp -f /mnt/hdd/mynode/bitcoin/bitcoin.conf /home/admin/.bitcoin/bitcoin.conf
chown bitcoin:bitcoin /mnt/hdd/mynode/bitcoin/bitcoin.conf
chown admin:admin /home/admin/.bitcoin/bitcoin.conf