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
|
|
|
|
2022-03-24 03:23:08 +00:00
|
|
|
# Append Watchtower Server Section
|
2022-03-20 21:27:41 +00:00
|
|
|
if [ -f /mnt/hdd/mynode/settings/watchtower_enabled ]; then
|
2021-04-01 01:41:52 +00:00
|
|
|
cat /usr/share/mynode/lnd_watchtower.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
|
|
|
|
2022-03-24 03:23:08 +00:00
|
|
|
# Append Watchtower Client Section
|
|
|
|
if [ -f /mnt/hdd/mynode/settings/watchtower_client_enabled ]; then
|
|
|
|
cat /usr/share/mynode/lnd_watchtower_client.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
|
|
|
|
2022-03-20 21:27:41 +00:00
|
|
|
# Append Tor/IP section (check new file or old file, should be migrated to new)
|
2022-06-16 03:45:39 +00:00
|
|
|
if [ -f /mnt/hdd/mynode/settings/btc_lnd_tor_enabled ] || [ -f /home/bitcoin/.mynode/btc_lnd_tor_enabled ]; then
|
2020-01-29 01:59:46 +00:00
|
|
|
cat /usr/share/mynode/lnd_tor.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
2022-05-05 04:57:17 +00:00
|
|
|
|
|
|
|
# Upadte LND Tor stream isolation (true is default)
|
|
|
|
if [ -f /mnt/hdd/mynode/settings/streamisolation_tor_disabled ]; then
|
|
|
|
sed -i "s/tor.streamisolation=.*/tor.streamisolation=false/g" /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
2020-01-29 01:59:46 +00:00
|
|
|
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
|