2019-11-04 04:50:47 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-10-08 17:34:04 +00:00
|
|
|
# Setup default settings (new - 2022)
|
|
|
|
if [ ! -f /mnt/hdd/mynode/settings/lnd_network_settings_defaulted ] && [ ! -f /home/bitcoin/.mynode/lnd_network_settings_defaulted ]; then
|
|
|
|
|
|
|
|
# based on old settings, set ipv4 or tor
|
|
|
|
if [ -f /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled_defaulted ] || [ -f /home/bitcoin/.mynode/.btc_lnd_tor_enabled_defaulted ]; then
|
|
|
|
if [ -f /home/bitcoin/.mynode/btc_lnd_tor_enabled ] || [ -f /mnt/hdd/mynode/settings/btc_lnd_tor_enabled ]; then
|
|
|
|
# Old settings indicate tor only
|
|
|
|
touch /home/bitcoin/.mynode/lnd_tor_enabled
|
|
|
|
touch /mnt/hdd/mynode/settings/lnd_tor_enabled
|
|
|
|
else
|
|
|
|
# Old settings indicate ipv4 only
|
|
|
|
touch /home/bitcoin/.mynode/lnd_ipv4_enabled
|
|
|
|
touch /mnt/hdd/mynode/settings/lnd_ipv4_enabled
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# Set new defaults
|
|
|
|
touch /home/bitcoin/.mynode/lnd_tor_enabled
|
|
|
|
touch /mnt/hdd/mynode/settings/lnd_tor_enabled
|
|
|
|
fi
|
|
|
|
|
|
|
|
touch /mnt/hdd/mynode/settings/lnd_network_settings_defaulted
|
|
|
|
touch /home/bitcoin/.mynode/lnd_network_settings_defaulted
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
|
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-10-08 17:34:04 +00:00
|
|
|
# Append Network Config (IPv4 / Tor)
|
|
|
|
if [ -f /mnt/hdd/mynode/settings/lnd_ipv4_enabled ] || [ -f /home/bitcoin/.mynode/lnd_ipv4_enabled ]; then
|
|
|
|
cat /usr/share/mynode/lnd_ipv4.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
else
|
|
|
|
cat /usr/share/mynode/lnd_no_ipv4.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
|
|
|
if [ -f /mnt/hdd/mynode/settings/lnd_tor_enabled ] || [ -f /home/bitcoin/.mynode/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
|
|
|
|
else
|
2022-10-08 17:34:04 +00:00
|
|
|
cat /usr/share/mynode/lnd_no_tor.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# 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 || true
|
2020-01-29 01:59:46 +00:00
|
|
|
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
|