keep lnd autopilot and autounlock mainnet only

mainnet only settings:
lnd autopilot
lnd keysend
circuibreaker
lnd autounlock
StaticChannelBackup to DropBox and USB
This commit is contained in:
openoms
2021-06-29 18:48:58 +01:00
parent 41f5d4d3b4
commit 7383b17a08
3 changed files with 55 additions and 60 deletions

View File

@@ -5,11 +5,8 @@ echo "get raspiblitz config"
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# use default values from the raspiblitz.conf
source <(/home/admin/config.scripts/network.aliases.sh getvars)
echo "services default values"
if [ ${#${netprefix}autoPilot} -eq 0 ]; then ${netprefix}autoPilot="off"; fi
if [ ${#autoPilot} -eq 0 ]; then autoPilot="off"; fi
if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
# if [ ${#chain} -eq 0 ]; then chain="main"; fi
@@ -56,12 +53,12 @@ if [ ${touchscreen} -gt 0 ]; then
touchscreenMenu='on'
fi
echo "check ${netprefix}autopilot in ${netprefix}lnd.conf"
lndAutoPilotOn=$(sudo cat /mnt/hdd/lnd/${netprefix}lnd.conf | grep -c 'autopilot.active=1')
echo "check autopilot in lnd.conf"
lndAutoPilotOn=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'autopilot.active=1')
if [ ${lndAutoPilotOn} -eq 1 ]; then
${netprefix}autoPilot="on"
autoPilot="on"
else
${netprefix}autoPilot="off"
autoPilot="off"
fi
echo "map keysend to on/off"
@@ -86,23 +83,25 @@ if [ "${displayClass}" == "lcd" ]; then
OPTIONS+=(s 'Touchscreen' ${touchscreenMenu})
OPTIONS+=(r 'LCD Rotate' ${lcdrotateMenu})
fi
OPTIONS+=(a 'Channel Autopilot' ${${netprefix}autoPilot})
if [ ${chain} = "main" ];then
OPTIONS+=(a 'Channel Autopilot' ${autoPilot})
OPTIONS+=(k 'Accept Keysend' ${keysend})
# OPTIONS+=(n 'Testnet' ${chainValue}) # deprecated option
# see the parallel network in SERVICES
OPTIONS+=(c 'Circuitbreaker (LND firewall)' ${circuitbreaker})
OPTIONS+=(u 'LND Auto-Unlock' ${autoUnlock})
OPTIONS+=(d 'StaticChannelBackup on DropBox' ${DropboxBackup})
OPTIONS+=(e 'StaticChannelBackup on USB Drive' ${LocalBackup})
fi
# OPTIONS+=(n 'Testnet' ${chainValue}) # deprecated option
# see the parallel network in SERVICES
OPTIONS+=(c 'Circuitbreaker (LND firewall)' ${circuitbreaker})
OPTIONS+=(u 'LND Auto-Unlock' ${autoUnlock})
OPTIONS+=(d 'StaticChannelBackup on DropBox' ${DropboxBackup})
OPTIONS+=(e 'StaticChannelBackup on USB Drive' ${LocalBackup})
OPTIONS+=(z 'ZeroTier' ${zerotierSwitch})
if [ ${#runBehindTor} -eq 0 ] || [ "${runBehindTor}" = "off" ]; then
OPTIONS+=(y ${dynDomainMenu} ${domainValue})
OPTIONS+=(b 'BTC UPnP (AutoNAT)' ${networkUPnP})
OPTIONS+=(l 'LND UPnP (AutoNAT)' ${autoNatDiscovery})
fi
if [ ${chain} = "main" ];then
if [ ${#runBehindTor} -eq 0 ] || [ "${runBehindTor}" = "off" ]; then
OPTIONS+=(y ${dynDomainMenu} ${domainValue})
OPTIONS+=(b 'BTC UPnP (AutoNAT)' ${networkUPnP})
OPTIONS+=(l 'LND UPnP (AutoNAT)' ${autoNatDiscovery})
fi
fi
CHOICES=$(dialog \
--title ' Node Settings & Options ' \
@@ -217,7 +216,7 @@ anychange=0
# AUTOPILOT process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "a")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${${netprefix}autoPilot}" != "${choice}" ]; then
if [ "${autoPilot}" != "${choice}" ]; then
echo "Autopilot Setting changed .."
anychange=1
sudo /home/admin/config.scripts/lnd.autopilot.sh ${choice}

View File

@@ -2,64 +2,62 @@
if [ $# -eq 0 ]; then
echo "small config script to switch the LND auto pilot on or off"
echo "lnd.autopilot.sh [on|off] <mainnet|testnet|signet>"
echo "lnd.autopilot.sh [on|off]"
exit 1
fi
# check lnd.conf exits
lndConfExists=$(sudo ls /mnt/hdd/lnd/${netprefix}lnd.conf | grep -c 'lnd.conf')
lndConfExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c 'lnd.conf')
if [ ${lndConfExists} -eq 0 ]; then
echo "FAIL - /mnt/hdd/lnd/${netprefix}lnd.conf not found"
echo "FAIL - /mnt/hdd/lnd/lnd.conf not found"
exit 1
fi
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd $2)
# stop services
echo "making sure services are not running"
sudo systemctl stop lnd 2>/dev/null
# check if "${netprefix}autopilot.active" exists
valueExists=$(sudo cat /mnt/hdd/lnd/${netprefix}lnd.conf | grep -c '${netprefix}autopilot.active=')
# check if "autopilot.active" exists
valueExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'autopilot.active=')
if [ ${valueExists} -eq 0 ]; then
echo "Adding ${netprefix}autopilot config defaults to /mnt/hdd/lnd/${netprefix}lnd.conf"
sudo sed -i '$ a [autopilot]' /mnt/hdd/lnd/${netprefix}lnd.conf
sudo sed -i '$ a autopilot.active=0' /mnt/hdd/lnd/${netprefix}lnd.conf
sudo sed -i '$ a autopilot.allocation=0.6' /mnt/hdd/lnd/${netprefix}lnd.conf
sudo sed -i '$ a autopilot.maxchannels=5' /mnt/hdd/lnd/${netprefix}lnd.conf
echo "Adding autopilot config defaults to /mnt/hdd/lnd/lnd.conf"
sudo sed -i '$ a [autopilot]' /mnt/hdd/lnd/lnd.conf
sudo sed -i '$ a autopilot.active=0' /mnt/hdd/lnd/lnd.conf
sudo sed -i '$ a autopilot.allocation=0.6' /mnt/hdd/lnd/lnd.conf
sudo sed -i '$ a autopilot.maxchannels=5' /mnt/hdd/lnd/lnd.conf
fi
# add default value to raspi config if needed
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#${netprefix}autoPilot} -eq 0 ]; then
echo "${netprefix}autoPilot=off" >> /mnt/hdd/raspiblitz.conf
if [ ${#autoPilot} -eq 0 ]; then
echo "autoPilot=off" >> /mnt/hdd/raspiblitz.conf
fi
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "switching the LND ${netprefix}autopilot ON"
echo "editing /mnt/hdd/lnd/${netprefix}lnd.conf"
sudo sed -i "s/^${netprefix}autopilot.active=.*/${netprefix}autopilot.active=1/g" /mnt/hdd/lnd/${netprefix}lnd.conf
echo "switching the LND autopilot ON"
echo "editing /mnt/hdd/lnd/lnd.conf"
sudo sed -i "s/^autopilot.active=.*/autopilot.active=1/g" /mnt/hdd/lnd/lnd.conf
echo "editing /mnt/hdd/raspiblitz.conf"
sudo sed -i "s/^${netprefix}autoPilot=.*/${netprefix}autoPilot=on/g" /mnt/hdd/raspiblitz.conf
echo "OK - ${netprefix}autopilot is now ON"
sudo sed -i "s/^autoPilot=.*/autoPilot=on/g" /mnt/hdd/raspiblitz.conf
echo "OK - autopilot is now ON"
echo "needs reboot to activate new setting"
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "switching the LND ${netprefix}autopilot OFF"
echo "editing /mnt/hdd/lnd/${netprefix}lnd.conf"
sudo sed -i "s/^${netprefix}autopilot.active=.*/${netprefix}autopilot.active=0/g" /mnt/hdd/lnd/${netprefix}lnd.conf
echo "switching the LND autopilot OFF"
echo "editing /mnt/hdd/lnd/lnd.conf"
sudo sed -i "s/^autopilot.active=.*/autopilot.active=0/g" /mnt/hdd/lnd/lnd.conf
echo "editing /mnt/hdd/raspiblitz.conf"
sudo sed -i "s/^${netprefix}autoPilot=.*/${netprefix}autoPilot=off/g" /mnt/hdd/raspiblitz.conf
echo "OK - ${netprefix}autopilot is now OFF"
sudo sed -i "s/^autoPilot=.*/autoPilot=off/g" /mnt/hdd/raspiblitz.conf
echo "OK - autopilot is now OFF"
echo "needs reboot to activate new setting"
exit 0
fi
echo "FAIL - Unknown Parameter $1"
echo "FAIL - Unknown Paramter $1"
echo "may needs reboot to run normal again"
exit 1

View File

@@ -14,15 +14,13 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then turn="on"; fi
# 2. parameter [?passwordC]
passwordC=$2
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd)
# run interactive if 'turn on' && no further parameters
if [ "${turn}" = "on" ] && [ ${#passwordC} -eq 0 ]; then
dialog --backtitle "${netprefix}LND Auto-Unlock" --inputbox "ENTER your PASSWORD C:
dialog --backtitle "LND Auto-Unlock" --inputbox "ENTER your PASSWORD C:
For more details see chapter in GitHub README
'Auto-unlock ${netprefix}LND on startup'
'Auto-unlock LND on startup'
https://github.com/rootzoll/raspiblitz
Password C will be stored on the device.
@@ -46,7 +44,7 @@ Password C will be stored on the device.
# test if correct
echo "# testing password .. please wait"
echo "SYSTEMD RESTART LOG: lightning (LND)" > /home/admin/systemd.lightning.log
sudo systemctl restart ${netprefix}lnd
sudo systemctl restart lnd
sleep 4
error=""
source <(sudo /home/admin/config.scripts/lnd.unlock.sh "$passwordC")
@@ -63,7 +61,7 @@ fi
configFile="/mnt/hdd/raspiblitz.conf"
# lnd conf file
lndConfig="/mnt/hdd/lnd/${netprefix}lnd.conf"
lndConfig="/mnt/hdd/lnd/lnd.conf"
# check if config file exists
configExists=$(ls ${configFile} | grep -c '.conf')
@@ -72,10 +70,10 @@ if [ ${configExists} -eq 0 ]; then
exit 1
fi
# make sure entry line for '${netprefix}autoUnlock' exists
entryExists=$(cat ${configFile} | grep -c '${netprefix}autoUnlock=')
# make sure entry line for 'autoUnlock' exists
entryExists=$(cat ${configFile} | grep -c 'autoUnlock=')
if [ ${entryExists} -eq 0 ]; then
echo "${netprefix}autoUnlock=" >> ${configFile}
echo "autoUnlock=" >> ${configFile}
fi
# switch on
@@ -84,11 +82,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# switching the Auto-Unlock ON"
# setting value in raspi blitz config
sudo sed -i "s/^${netprefix}autoUnlock=.*/${netprefix}autoUnlock=on/g" /mnt/hdd/raspiblitz.conf
sudo sed -i "s/^autoUnlock=.*/autoUnlock=on/g" /mnt/hdd/raspiblitz.conf
# password C needs to be stored on RaspiBlitz
echo "# storing password for root in /root/${netprefix}lnd.autounlock.pwd "
sudo sh -c "echo \"${passwordC}\" > /root/${netprefix}lnd.autounlock.pwd "
echo "# storing password for root in /root/lnd.autounlock.pwd"
sudo sh -c "echo \"${passwordC}\" > /root/lnd.autounlock.pwd"
echo "# Auto-Unlock is now ON"
echo "# NOTE: you may need to reconnect mobile/external wallets (macaroon/tls)"
@@ -100,11 +98,11 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "# switching the Auto-Unlock OFF"
# setting value in raspi blitz config
sudo sed -i "s/^${netprefix}autoUnlock=.*/${netprefix}autoUnlock=off/g" /mnt/hdd/raspiblitz.conf
sudo sed -i "s/^autoUnlock=.*/autoUnlock=off/g" /mnt/hdd/raspiblitz.conf
# delete password C securly
echo "# shredding password on for RaspiBlitz Auto-Unlock"
sudo shred -u /root/${netprefix}lnd.autounlock.pwd 2>/dev/null
sudo shred -u /root/lnd.autounlock.pwd 2>/dev/null
echo "# Auto-Unlock is now OFF"
exit 0