2021-05-10 23:13:08 +01:00
#!/bin/bash
# https://lightning.readthedocs.io/
# https://github.com/ElementsProject/lightning/releases
2021-12-07 14:00:44 +00:00
CLVERSION = v0.10.2
2021-07-07 07:37:23 +01:00
# install the latest master by using the last commit id
2021-08-10 16:11:40 +01:00
# https://github.com/ElementsProject/lightning/commit/master
# CLVERSION="063366ed7e3b7cc12a8d1681acc2b639cf07fa23"
2021-05-10 23:13:08 +01:00
2021-12-17 21:43:19 +01:00
# https://github.com/ElementsProject/lightning/tree/master/contrib/keys
# PGPsigner="rustyrussel"
2022-02-07 14:19:25 +00:00
# PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/rustyrussell.txt"
# PGPpubkeyFingerprint="D9200E6CD1ADB8F1"
2021-12-17 21:43:19 +01:00
PGPsigner = "cdecker"
2022-02-07 14:19:25 +00:00
PGPpubkeyLink = " https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/ ${ PGPsigner } .txt "
PGPpubkeyFingerprint = "A26D6D9FE088ED58"
2021-12-17 21:43:19 +01:00
2021-05-10 23:13:08 +01:00
# help
if [ $# -eq 0 ] || [ " $1 " = "-h" ] || [ " $1 " = "--help" ] ; then
echo
echo "C-lightning install script"
2021-09-22 16:06:37 +01:00
echo " The default version is: $CLVERSION "
2021-07-12 15:37:43 +01:00
echo "mainnet / testnet / signet instances can run parallel"
2021-05-10 23:13:08 +01:00
echo
2021-09-22 16:06:37 +01:00
echo "Usage:"
2021-12-07 14:00:44 +00:00
echo "cl.install.sh install - called by build_sdcard.sh"
2021-09-26 10:30:09 +01:00
echo "cl.install.sh on <mainnet|testnet|signet>"
echo "cl.install.sh off <mainnet|testnet|signet> <purge>"
echo "cl.install.sh [update <version>|testPR <PRnumber>]"
echo "cl.install.sh display-seed <mainnet|testnet|signet>"
2021-05-10 23:13:08 +01:00
echo
exit 1
fi
2022-01-02 22:06:03 +00:00
function installDependencies( )
{
echo "- Install build dependencies"
# from https://lightning.readthedocs.io/INSTALL.html#to-build-on-ubuntu
sudo apt-get install -y \
autoconf automake build-essential git libtool libgmp-dev \
libsqlite3-dev python3 python3-mako net-tools zlib1g-dev libsodium-dev \
gettext
# additional requirements
sudo apt-get install -y postgresql libpq-dev
2022-01-12 15:39:30 +00:00
sudo pip3 install mrkd = = 0.2.0
sudo pip3 install mistune = = 0.8.4
2022-01-12 14:47:18 +00:00
# for pylightning
echo "- Install from the requirements.txt"
2022-01-02 22:06:03 +00:00
sudo -u bitcoin pip3 install --user mrkd = = 0.2.0
sudo -u bitcoin pip3 install --user mistune = = 0.8.4
sudo -u bitcoin pip3 install --user -r requirements.txt
}
2022-02-07 14:49:46 +00:00
function buildAndInstallCLbinaries( )
{
echo "- Configuring EXPERIMENTAL_FEATURES enabled"
echo
sudo -u bitcoin ./configure --enable-experimental-features
echo
echo "- Building C-lightning from source"
echo
sudo -u bitcoin make
echo
echo "- Install to /usr/local/bin/"
sudo make install || exit 1
}
2021-12-07 14:00:44 +00:00
if [ " $1 " = "install" ] ; then
2021-12-17 21:43:19 +01:00
echo " # *** INSTALL C-LIGHTNING ${ CLVERSION } BINARY *** "
echo "# only binary install to system"
echo "# no configuration, no systemd service"
2021-12-07 14:00:44 +00:00
2022-01-02 22:06:03 +00:00
# check if the binary is already installed
2022-02-07 14:19:25 +00:00
if [ -f /usr/local/bin/lightningd ] ; then
2021-12-17 21:43:19 +01:00
echo "c-lightning binary already installed - done"
exit 1
fi
2021-12-07 14:00:44 +00:00
2022-02-07 14:49:46 +00:00
## Download and verify zip
2022-02-07 14:19:25 +00:00
# # prepare download dir
# sudo rm -rf /home/bitcoin/download
# sudo -u bitcoin mkdir -p /home/bitcoin/download
# cd /home/bitcoin/download || exit 1
#
# sudo -u bitcoin wget -O "pgp_keys.asc" ${PGPpubkeyLink}
# sudo -u bitcoin gpg --import --import-options show-only ./pgp_keys.asc
# fingerprint=$(gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPpubkeyFingerprint}" -c)
# if [ ${fingerprint} -lt 1 ]; then
# echo
# echo "!!! WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}"
# echo "Should contain PGP: ${PGPpubkeyFingerprint}"
# echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
# read key
# fi
# sudo -u bitcoin gpg --import ./pgp_keys.asc
#
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS.asc
#
# verifyResult=$(sudo -u bitcoin gpg --verify SHA256SUMS.asc 2>&1)
#
# goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
# echo "goodSignature(${goodSignature})"
# correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${PGPpubkeyFingerprint}" -c)
# echo "correctKey(${correctKey})"
# if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
# echo
# echo "!!! DOWNLOAD FAILED --> PGP verification not OK / signature(${goodSignature}) verify(${correctKey})"
# exit 1
# else
# echo
# echo "****************************************************************"
# echo "OK --> the PGP signature of the C-lightning SHA256SUMS is correct"
# echo "****************************************************************"
# echo
# fi
#
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/clightning-${CLVERSION}.zip
#
# hashCheckResult=$(sha256sum -c SHA256SUMS 2>&1)
# goodHash=$(echo ${hashCheckResult} | grep 'OK' -c)
# echo "goodHash(${goodHash})"
# if [ ${goodHash} -lt 1 ]; then
# echo
# echo "!!! BUILD FAILED --> Hash check not OK"
# exit 1
# else
# echo
# echo "********************************************************************"
# echo "OK --> the hash of the downloaded C-lightning source code is correct"
# echo "********************************************************************"
# echo
# fi
#
# sudo -u bitcoin unzip clightning-${CLVERSION}.zip
# cd clightning-${CLVERSION} || exit 1
2022-02-07 14:49:46 +00:00
# download and verify the source from github
2022-02-07 14:19:25 +00:00
cd /home/bitcoin || exit 1
echo
echo "- Cloning https://github.com/ElementsProject/lightning.git"
echo
sudo -u bitcoin git clone https://github.com/ElementsProject/lightning.git
cd lightning || exit 1
echo
echo " - Reset to version $CLVERSION "
sudo -u bitcoin git reset --hard $CLVERSION
2021-12-07 14:00:44 +00:00
2022-02-07 14:19:25 +00:00
sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \
" ${ PGPsigner } " " ${ PGPpubkeyLink } " " ${ PGPpubkeyFingerprint } " " ${ CLVERSION } " || exit 1
2022-01-02 22:06:03 +00:00
installDependencies
2022-02-07 14:49:46 +00:00
buildAndInstallCLbinaries
2021-12-07 14:00:44 +00:00
2022-01-11 19:01:55 +00:00
installed = $( sudo -u bitcoin lightning-cli --version)
2021-12-07 14:00:44 +00:00
if [ ${# installed } -eq 0 ] ; then
echo
echo "!!! BUILD FAILED --> Was not able to install C-lightning"
exit 1
fi
correctVersion = $( echo " ${ installed } " | grep -c " ${ CLVERSION : 1 } " )
2022-02-07 14:19:25 +00:00
if [ " ${ correctVersion } " -eq 0 ] ; then
2021-12-07 14:00:44 +00:00
echo
echo " !!! BUILD FAILED --> installed C-lightning is not version ${ CLVERSION } "
2022-01-11 19:01:55 +00:00
sudo -u bitcoin lightning-cli --version
2021-12-07 14:00:44 +00:00
exit 1
fi
2021-12-08 21:31:34 +00:00
echo
2021-12-07 14:00:44 +00:00
echo " - OK the installation of C-lightning v ${ installed } is successful "
exit 0
fi
2021-12-08 13:58:30 +00:00
# vars
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
2021-05-10 23:13:08 +01:00
TORGROUP = "debian-tor"
2021-09-27 23:34:49 +01:00
if [ " $1 " = update ] || [ " $1 " = testPR ] ; then
source <( /home/admin/config.scripts/network.aliases.sh getvars cl mainnet)
else
source <( /home/admin/config.scripts/network.aliases.sh getvars cl $2 )
fi
2021-05-10 23:13:08 +01:00
2021-09-26 10:30:09 +01:00
echo " # Running: 'cl.install.sh $* ' "
2021-06-23 11:29:04 +01:00
echo " # Using the settings for: ${ network } ${ CHAIN } "
2021-05-10 23:13:08 +01:00
2021-09-27 23:34:49 +01:00
if [ " $1 " = on ] || [ " $1 " = update ] || [ " $1 " = testPR ] ; then
2021-08-28 20:51:10 +02:00
2021-08-30 20:53:37 +02:00
if [ " ${ CHAIN } " = = "testnet" ] && [ " ${ testnet } " != "on" ] ; then
2021-09-26 10:30:09 +01:00
echo "# before activating testnet on cl, first activate testnet on bitcoind"
2021-08-30 20:53:37 +02:00
echo "err='missing bitcoin testnet'"
exit 1
fi
if [ " ${ CHAIN } " = = "signet" ] && [ " ${ signet } " != "on" ] ; then
2021-09-26 10:30:09 +01:00
echo "# before activating signet on cl, first activate signet on bitcoind"
2021-08-30 20:53:37 +02:00
echo "err='missing bitcoin signet'"
exit 1
fi
2021-08-28 20:51:10 +02:00
2022-02-07 14:49:46 +00:00
if [ " $1 " = "update" ] || [ " $1 " = "testPR" ] ; then
2021-08-30 20:53:37 +02:00
2021-05-10 23:13:08 +01:00
echo "# apt update"
echo
sudo apt-get update
cd /home/bitcoin || exit 1
2022-02-07 14:49:46 +00:00
if [ " $1 " = "update" ] || [ " $1 " = "testPR" ] ; then
2021-05-10 23:13:08 +01:00
echo
echo "# Deleting the old source code"
sudo rm -rf lightning
fi
echo
echo "# Cloning https://github.com/ElementsProject/lightning.git"
echo
sudo -u bitcoin git clone https://github.com/ElementsProject/lightning.git
cd lightning || exit 1
2021-09-22 14:37:45 +01:00
echo
if [ " $1 " = "update" ] ; then
if [ $# -gt 1 ] ; then
CLVERSION = $2
echo " # Installing the version $CLVERSION "
2021-09-28 10:40:00 +01:00
sudo -u bitcoin git reset --hard $CLVERSION
2021-09-22 14:37:45 +01:00
else
echo "# Updating to the latest commit in:"
echo "# https://github.com/ElementsProject/lightning"
2021-10-01 08:53:46 +01:00
echo "# Make sure this is intended, there might be no way to downgrade your database"
echo "# Press ENTER to continue or CTRL+C to abort the update"
read -r key
2021-09-22 14:37:45 +01:00
fi
2021-05-10 23:13:08 +01:00
2021-09-22 14:37:45 +01:00
elif [ " $1 " = "testPR" ] ; then
2021-05-10 23:13:08 +01:00
PRnumber = $2 || exit 1
echo "# Using the PR:"
echo " # https://github.com/ElementsProject/lightning/pull/ $PRnumber "
sudo -u bitcoin git fetch origin pull/$PRnumber /head:pr$PRnumber || exit 1
sudo -u bitcoin git checkout pr$PRnumber || exit 1
fi
2022-01-02 22:06:03 +00:00
installDependencies
2021-05-10 23:13:08 +01:00
currentCLversion = $( cd /home/bitcoin/lightning 2>/dev/null; \
git describe --tags 2>/dev/null)
echo " # Building from source C-lightning $currentCLversion "
2022-02-07 14:49:46 +00:00
buildAndInstallCLbinaries
2021-05-10 23:13:08 +01:00
fi
2021-06-28 19:01:58 +01:00
##########
# Config #
##########
2021-05-10 23:13:08 +01:00
2022-02-07 14:49:46 +00:00
# make sure binary is installed (will skip if already done)
/home/admin/config.scripts/cl.install.sh install
2021-05-10 23:13:08 +01:00
echo " # Make sure bitcoin is in the ${ TORGROUP } group "
sudo usermod -a -G ${ TORGROUP } bitcoin
2021-09-26 10:30:09 +01:00
echo " # Add plugin-dir: /home/bitcoin/ ${ netprefix } cl-plugins-enabled "
echo "# Add plugin-dir: /home/bitcoin/cl-plugins-available"
2021-06-23 11:29:04 +01:00
# note that the disk is mounted with noexec
2021-09-26 10:30:09 +01:00
sudo -u bitcoin mkdir /home/bitcoin/${ netprefix } cl-plugins-enabled 2>/dev/null
sudo -u bitcoin mkdir /home/bitcoin/cl-plugins-available 2>/dev/null
2021-06-29 17:46:12 +01:00
2021-05-10 23:13:08 +01:00
echo "# Store the lightning data in /mnt/hdd/app-data/.lightning"
echo "# Symlink to /home/bitcoin/"
sudo rm -rf /home/bitcoin/.lightning # not a symlink, delete
sudo mkdir -p /mnt/hdd/app-data/.lightning
sudo ln -s /mnt/hdd/app-data/.lightning /home/bitcoin/
2021-08-10 17:06:06 +01:00
if [ ${ CLNETWORK } != "bitcoin" ] && [ ! -d /home/bitcoin/.lightning/${ CLNETWORK } ] ; then
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${ CLNETWORK }
fi
2021-07-20 14:05:58 +01:00
2021-09-26 10:30:09 +01:00
if ! sudo ls ${ CLCONF } ; then
echo " # Create ${ CLCONF } "
2021-07-21 23:47:22 +01:00
echo " # lightningd configuration for ${ network } ${ CHAIN }
2021-05-10 23:13:08 +01:00
2021-06-23 11:29:04 +01:00
network = ${ CLNETWORK }
2021-05-10 23:13:08 +01:00
log-file= cl.log
2021-08-31 11:51:33 +01:00
log-level= info
2021-09-26 10:30:09 +01:00
plugin-dir= /home/bitcoin/${ netprefix } cl-plugins-enabled
2021-05-10 23:13:08 +01:00
# Tor settings
proxy = 127.0.0.1:9050
bind-addr= 127.0.0.1:${ portprefix } 9736
2021-07-06 10:12:08 +01:00
addr = statictor:127.0.0.1:9051/torport= ${ portprefix } 9736
2021-05-10 23:13:08 +01:00
always-use-proxy= true
2021-09-26 10:30:09 +01:00
" | sudo tee ${ CLCONF }
2021-05-10 23:13:08 +01:00
else
2021-09-26 10:30:09 +01:00
echo " # The file ${ CLCONF } is already present "
2021-05-10 23:13:08 +01:00
fi
sudo chown -R bitcoin:bitcoin /mnt/hdd/app-data/.lightning
sudo chown -R bitcoin:bitcoin /home/bitcoin/
2021-12-18 22:07:37 +00:00
## Create a wallet from seedwords for mainnet
if [ ${ CHAIN } = "mainnet" ] ; then
hsmSecretPath = " /home/bitcoin/.lightning/ ${ CLNETWORK } /hsm_secret "
if sudo ls $hsmSecretPath ; then
echo " # $hsmSecretPath is already present "
else
echo "Create a wallet from seedwords for mainnet"
/home/admin/config.scripts/cl.hsmtool.sh new-force mainnet
fi
fi
2021-07-18 20:29:07 +01:00
#################
# Backup plugin #
#################
2021-09-26 10:30:09 +01:00
/home/admin/config.scripts/cl-plugin.backup.sh on $CHAIN
2021-07-18 20:29:07 +01:00
2021-06-28 19:01:58 +01:00
###################
# Systemd service #
###################
2021-09-26 10:30:09 +01:00
/home/admin/config.scripts/cl.install-service.sh $CHAIN
2021-06-28 19:01:58 +01:00
2021-10-01 07:41:44 +01:00
#############
# logrotate #
#############
2021-10-01 08:53:46 +01:00
echo
echo " # Set logrotate for ${ netprefix } lightningd "
2022-01-12 19:37:19 +00:00
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${ CLNETWORK } /cl.log_old
2021-10-01 07:41:44 +01:00
echo " \
/home/bitcoin/.lightning/${ CLNETWORK } /cl.log
{
rotate 5
daily
copytruncate
missingok
olddir /home/bitcoin/.lightning/${ CLNETWORK } /cl.log_old
notifempty
nocompress
sharedscripts
# We don't need to kill as we use copytruncate
#postrotate
# kill -HUP \`cat /run/lightningd/lightningd.pid\'
#endscript
su bitcoin bitcoin
} " | sudo tee /etc/logrotate.d/ ${ netprefix } lightningd
# debug:
# sudo logrotate --debug /etc/logrotate.d/lightningd
2021-05-10 23:13:08 +01:00
echo
2021-12-23 20:32:07 +00:00
sudo -u admin touch /home/admin/_aliases
2021-10-01 08:53:46 +01:00
if ! grep -Eq " ${ netprefix } lightning-cli " /home/admin/_aliases; then
echo "# Adding aliases"
echo " \
2021-05-25 14:24:17 +01:00
alias ${ netprefix } lightning-cli= \" sudo -u bitcoin /usr/local/bin/lightning-cli\
2021-09-26 10:30:09 +01:00
--conf= ${ CLCONF } \"
alias ${ netprefix } cl = \" sudo -u bitcoin /usr/local/bin/lightning-cli\
--conf= ${ CLCONF } \"
alias ${ netprefix } cllog = \" sudo\
2021-07-18 20:28:04 +01:00
tail -n 30 -f /home/bitcoin/.lightning/${ CLNETWORK } /cl.log\"
2021-09-26 10:30:09 +01:00
alias ${ netprefix } clconf = \" sudo\
nano ${ CLCONF } \"
2021-06-28 19:01:58 +01:00
" | sudo tee -a /home/admin/_aliases
2021-10-01 08:53:46 +01:00
sudo chown admin:admin /home/admin/_aliases
fi
2021-05-10 23:13:08 +01:00
echo " # The installed C-lightning version is: $( sudo -u bitcoin /usr/local/bin/lightningd --version) "
echo
echo "# To activate the aliases reopen the terminal or use:"
2021-06-28 19:01:58 +01:00
echo "source ~/_aliases"
2021-05-25 14:24:17 +01:00
echo " # Monitor the ${ netprefix } lightningd with: "
echo " sudo journalctl -fu ${ netprefix } lightningd "
echo " sudo systemctl status ${ netprefix } lightningd "
2021-05-10 23:13:08 +01:00
echo "# logs:"
2021-06-23 11:29:04 +01:00
echo " sudo tail -f /home/bitcoin/.lightning/ ${ CLNETWORK } /cl.log "
2021-05-10 23:13:08 +01:00
echo "# for the command line options use"
2021-05-25 14:24:17 +01:00
echo " ${ netprefix } lightning-cli help "
2021-05-10 23:13:08 +01:00
echo
2021-05-22 11:27:16 +01:00
2021-09-22 14:37:45 +01:00
# setting value in the raspiblitz.conf
2021-12-14 23:34:35 +01:00
/home/admin/config.scripts/blitz.conf.sh set ${ netprefix } cl on
2021-05-22 11:27:16 +01:00
2021-09-22 14:37:45 +01:00
# if this is the first lightning mainnet turned on - make default
2021-08-30 20:19:57 +02:00
if [ " ${ CHAIN } " = = "mainnet" ] && [ " ${ lightning } " = = "" ] ; then
2021-09-26 10:30:09 +01:00
echo "# CL is now the default lightning implementation"
2021-12-14 23:34:35 +01:00
/home/admin/config.scripts/blitz.conf.sh set lightning cl
2021-08-30 20:19:57 +02:00
fi
2021-05-22 11:27:16 +01:00
exit 0
2021-05-10 23:13:08 +01:00
fi
2021-09-09 14:56:58 +02:00
if [ " $1 " = "display-seed" ] ; then
2021-09-09 15:12:14 +02:00
# check if sudo
if [ " $EUID " -ne 0 ] ; then
echo "Please run as root (with sudo)"
exit 1
fi
2021-09-22 14:37:45 +01:00
# get network and aliases from second parameter (default mainnet)
2021-09-09 14:56:58 +02:00
displayNetwork = $2
if [ " ${ displayNetwork } " = = "" ] ; then
displayNetwork = "mainnet"
fi
2021-09-26 10:30:09 +01:00
source <( /home/admin/config.scripts/network.aliases.sh getvars cl $displayNetwork )
2021-09-09 14:56:58 +02:00
# check if seedword file exists
2021-09-09 15:12:14 +02:00
seedwordFile = " /home/bitcoin/.lightning/ ${ CLNETWORK } /seedwords.info "
2021-09-22 14:37:45 +01:00
echo " # seedwordFile( ${ seedwordFile } ) "
2021-09-09 15:12:14 +02:00
seedwordFileExists = $( ls ${ seedwordFile } 2>/dev/null | grep -c "seedwords.info" )
2021-12-14 17:25:41 +00:00
echo " # seedwordFileExists( ${ seedwordFileExists } ) "
2021-09-09 15:12:14 +02:00
if [ " ${ seedwordFileExists } " = = "1" ] ; then
source ${ seedwordFile }
2021-09-09 15:13:44 +02:00
#echo "# seedwords(${seedwords})"
#echo "# seedwords6x4(${seedwords6x4})"
2022-02-09 10:17:41 +00:00
if [ ${# seedwords6x4 } -gt 0 ] ; then
ack = 0
while [ ${ ack } -eq 0 ]
do
whiptail --title " C-Lightning ${ displayNetwork } Wallet " \
--msgbox " This is your C-Lightning ${ displayNetwork } wallet seed. Store these numbered words in a safe location:\n\n ${ seedwords6x4 } " 13 76
whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55
if [ $? -eq 1 ] ; then
ack = 1
fi
done
else
dialog \
--title " C-Lightning ${ displayNetwork } Wallet " \
--exit-label "exit" \
--textbox " ${ seedwordFile } " 14 92
fi
2021-09-09 14:56:58 +02:00
else
2021-09-22 14:37:45 +01:00
# hsmFile="/home/bitcoin/.lightning/${CLNETWORK}/hsm_secret"
2021-09-09 15:08:21 +02:00
whiptail --title " C-Lightning ${ displayNetwork } Wallet Info " --msgbox " Your C-Lightning ${ displayNetwork } wallet was already created before - there are no seed words available.\n\nTo secure your wallet secret you can manually backup the file: /home/bitcoin/.lightning/ ${ CLNETWORK } /hsm_secret " 11 76
2021-09-09 14:56:58 +02:00
fi
exit 0
fi
2021-05-10 23:13:08 +01:00
if [ " $1 " = "off" ] ; then
2021-05-25 14:24:17 +01:00
echo " # Removing the ${ netprefix } lightningd.service "
sudo systemctl disable ${ netprefix } lightningd
sudo systemctl stop ${ netprefix } lightningd
2021-05-10 23:13:08 +01:00
echo "# Removing the aliases"
2021-06-28 19:01:58 +01:00
sudo sed -i " / ${ netprefix } lightning-cli/d " /home/admin/_aliases
sudo sed -i " / ${ netprefix } cl/d " /home/admin/_aliases
2021-05-10 23:13:08 +01:00
if [ " $( echo " $@ " | grep -c purge) " -gt 0 ] ; then
echo "# Removing the binaries"
sudo rm -f /usr/local/bin/lightningd
sudo rm -f /usr/local/bin/lightning-cli
fi
2021-09-22 14:37:45 +01:00
# setting value in the raspiblitz.conf
2021-12-14 23:34:35 +01:00
/home/admin/config.scripts/blitz.conf.sh set ${ netprefix } cl "off"
2021-08-30 20:19:57 +02:00
2021-09-26 10:30:09 +01:00
# if cl mainnet was default - remove
if [ " ${ CHAIN } " = = "mainnet" ] && [ " ${ lightning } " = = "cl" ] ; then
echo "# CL is REMOVED as the default lightning implementation"
2021-12-14 23:34:35 +01:00
/home/admin/config.scripts/blitz.conf.sh set lightning ""
2021-08-30 20:19:57 +02:00
if [ " ${ lnd } " = = "on" ] ; then
2021-09-22 14:37:45 +01:00
echo "# LND is now the new default lightning implementation"
2021-12-14 23:34:35 +01:00
/home/admin/config.scripts/blitz.conf.sh set lightning "lnd"
2021-08-30 20:19:57 +02:00
fi
fi
2021-05-10 23:13:08 +01:00
fi