2019-11-04 04:50:47 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-05-14 01:05:04 +00:00
|
|
|
# Setup Initial LND Node Name
|
|
|
|
if [ ! -f /mnt/hdd/mynode/settings/.lndalias ]; then
|
|
|
|
echo "mynodebtc.com [myNode]" > /mnt/hdd/mynode/settings/.lndalias
|
|
|
|
fi
|
|
|
|
|
2019-11-04 04:50:47 +00:00
|
|
|
# Generate LND Config
|
2019-11-05 01:34:19 +00:00
|
|
|
if [ -f /mnt/hdd/mynode/settings/lnd_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/lnd_custom.conf /mnt/hdd/mynode/lnd/lnd.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/lnd.conf /mnt/hdd/mynode/lnd/lnd.conf
|
2020-01-29 01:59:46 +00:00
|
|
|
|
2021-03-09 03:55:39 +00:00
|
|
|
# Append Tor/IP section
|
2020-01-29 01:59:46 +00:00
|
|
|
if [ -f /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled ]; then
|
|
|
|
cat /usr/share/mynode/lnd_tor.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
else
|
|
|
|
cat /usr/share/mynode/lnd_ipv4.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
2021-03-09 03:55:39 +00:00
|
|
|
|
|
|
|
# Append Mainnet/Testnet section
|
|
|
|
if [ -f /mnt/hdd/mynode/settings/.testnet_enabled ]; then
|
|
|
|
sed -i "s/bitcoin.mainnet=.*/bitcoin.mainnet=0/g" /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
sed -i "s/bitcoin.testnet=.*/bitcoin.testnet=1/g" /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
cat /usr/share/mynode/lnd_testnet.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
2019-11-05 01:34:19 +00:00
|
|
|
fi
|
2019-11-04 04:50:47 +00:00
|
|
|
|
2020-04-05 22:43:06 +00:00
|
|
|
# Append tor domain
|
|
|
|
if [ -f /var/lib/tor/mynode_lnd/hostname ]; then
|
|
|
|
echo "" >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
echo "[Application Options]" >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
ONION_URL=$(cat /var/lib/tor/mynode_lnd/hostname)
|
|
|
|
echo "tlsextradomain=$ONION_URL" >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
echo "" >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
|
|
|
|
2019-11-04 04:50:47 +00:00
|
|
|
ALIAS=$(cat /mnt/hdd/mynode/settings/.lndalias)
|
|
|
|
sed -i "s/alias=.*/alias=$ALIAS/g" /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
chown bitcoin:bitcoin /mnt/hdd/mynode/lnd/lnd.conf
|