mirror of
https://github.com/Retropex/raspiblitz.git
synced 2025-05-13 03:30:49 +02:00
fix variable names
This commit is contained in:
parent
d8589f6ce0
commit
a8cb408d80
@ -52,13 +52,13 @@ fi
|
||||
|
||||
# prefix for parallel services
|
||||
if [ ${CHAIN} = testnet ];then
|
||||
chainprefix="t"
|
||||
netprefix="t"
|
||||
portprefix=1
|
||||
elif [ ${CHAIN} = signet ];then
|
||||
chainprefix="s"
|
||||
netprefix="s"
|
||||
portprefix=3
|
||||
elif [ ${CHAIN} = mainnet ];then
|
||||
chainprefix=""
|
||||
netprefix=""
|
||||
portprefix=""
|
||||
fi
|
||||
|
||||
@ -104,13 +104,13 @@ Activate TOR to access the web interface from outside your local network.
|
||||
fi
|
||||
|
||||
# add default value to raspi config if needed
|
||||
if ! grep -Eq "^${chainprefix}${typeprefix}rtlWebinterface=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "${chainprefix}${typeprefix}rtlWebinterface=off" >> /mnt/hdd/raspiblitz.conf
|
||||
if ! grep -Eq "^${netprefix}${typeprefix}rtlWebinterface=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "${netprefix}${typeprefix}rtlWebinterface=off" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
# stop services
|
||||
echo "# making sure services are not running"
|
||||
sudo systemctl stop ${chainprefix}${typeprefix}RTL 2>/dev/null
|
||||
sudo systemctl stop ${netprefix}${typeprefix}RTL 2>/dev/null
|
||||
|
||||
function configRTL() {
|
||||
|
||||
@ -175,9 +175,9 @@ EOF
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "# Installing the RTL for ${LNTYPE} ${CHAIN}"
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/${chainprefix}${typeprefix}RTL.service 2>/dev/null | grep -c "${chainprefix}${typeprefix}RTL.service")
|
||||
isInstalled=$(sudo ls /etc/systemd/system/${netprefix}${typeprefix}RTL.service 2>/dev/null | grep -c "${netprefix}${typeprefix}RTL.service")
|
||||
if ! [ ${isInstalled} -eq 0 ]; then
|
||||
echo "# OK, the ${chainprefix}${typeprefix}RTL.service is already installed."
|
||||
echo "# OK, the ${netprefix}${typeprefix}RTL.service is already installed."
|
||||
else
|
||||
# check and install NodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
@ -230,19 +230,19 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
fi
|
||||
|
||||
echo "# Updating Firewall"
|
||||
sudo ufw allow ${RTLHTTP} comment "${chainprefix}${typeprefix}RTL HTTP"
|
||||
sudo ufw allow $((RTLHTTP+1)) comment "${chainprefix}${typeprefix}RTL HTTPS"
|
||||
sudo ufw allow ${RTLHTTP} comment "${netprefix}${typeprefix}RTL HTTP"
|
||||
sudo ufw allow $((RTLHTTP+1)) comment "${netprefix}${typeprefix}RTL HTTPS"
|
||||
echo
|
||||
|
||||
if [ $LNTYPE = lnd ];then
|
||||
echo "# Install service"
|
||||
echo "# Install RTL systemd for ${network} on ${chain}"
|
||||
cat > /home/admin/${chainprefix}${typeprefix}RTL.service <<EOF
|
||||
# Systemd unit for ${chainprefix}${typeprefix}RTL
|
||||
# /etc/systemd/system/${chainprefix}${typeprefix}RTL.service
|
||||
cat > /home/admin/${netprefix}${typeprefix}RTL.service <<EOF
|
||||
# Systemd unit for ${netprefix}${typeprefix}RTL
|
||||
# /etc/systemd/system/${netprefix}${typeprefix}RTL.service
|
||||
|
||||
[Unit]
|
||||
Description=${chainprefix}${typeprefix}RTL daemon
|
||||
Description=${netprefix}${typeprefix}RTL daemon
|
||||
Wants=lnd.service
|
||||
After=lnd.service
|
||||
|
||||
@ -258,9 +258,9 @@ StandardError=journal
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
sudo mv /home/admin/${chainprefix}${typeprefix}RTL.service /etc/systemd/system/${chainprefix}${typeprefix}RTL.service
|
||||
sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${CHAIN}|" /etc/systemd/system/${chainprefix}${typeprefix}RTL.service
|
||||
sudo chown root:root /etc/systemd/system/${chainprefix}${typeprefix}RTL.service
|
||||
sudo mv /home/admin/${netprefix}${typeprefix}RTL.service /etc/systemd/system/${netprefix}${typeprefix}RTL.service
|
||||
sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${CHAIN}|" /etc/systemd/system/${netprefix}${typeprefix}RTL.service
|
||||
sudo chown root:root /etc/systemd/system/${netprefix}${typeprefix}RTL.service
|
||||
|
||||
elif [ $LNTYPE = cln ];then
|
||||
|
||||
@ -268,19 +268,19 @@ EOF
|
||||
/home/admin/config.scripts/bonus.clnrest.sh on ${CHAIN}
|
||||
|
||||
echo "
|
||||
# Systemd unit for ${chainprefix}${typeprefix}RTL
|
||||
# /etc/systemd/system/${chainprefix}${typeprefix}RTL.service
|
||||
# Systemd unit for ${netprefix}${typeprefix}RTL
|
||||
# /etc/systemd/system/${netprefix}${typeprefix}RTL.service
|
||||
|
||||
[Unit]
|
||||
Description=${chainprefix}${typeprefix}RTL daemon
|
||||
Wants=${chainprefix}lightning.service
|
||||
After=${chainprefix}lightning.service
|
||||
Description=${netprefix}${typeprefix}RTL daemon
|
||||
Wants=${netprefix}lightning.service
|
||||
After=${netprefix}lightning.service
|
||||
|
||||
[Service]
|
||||
Environment=\"PORT=$RTLHTTP\"
|
||||
Environment=\"LN_IMPLEMENTATION=CLT\"
|
||||
Environment=\"LN_SERVER_URL=https://localhost:${portprefix}6100\"
|
||||
Environment=\"CONFIG_PATH=/home/bitcoin/.lightning/${chainprefix}config\"
|
||||
Environment=\"CONFIG_PATH=/home/bitcoin/.lightning/${netprefix}config\"
|
||||
Environment=\"MACAROON_PATH=/home/bitcoin/c-lightning-REST/certs\"
|
||||
ExecStart=/usr/bin/node /home/rtl/RTL/rtl
|
||||
User=rtl
|
||||
@ -292,58 +292,58 @@ StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
" | sudo tee /etc/systemd/system/${chainprefix}${typeprefix}RTL.service
|
||||
" | sudo tee /etc/systemd/system/${netprefix}${typeprefix}RTL.service
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "# Setup nginx symlinks"
|
||||
if ! [ -f /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_ssl.conf ]; then
|
||||
sudo cp /home/admin/assets/nginx/sites-available/rtl_ssl.conf /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_ssl.conf
|
||||
if ! [ -f /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf ]; then
|
||||
sudo cp /home/admin/assets/nginx/sites-available/rtl_ssl.conf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf
|
||||
fi
|
||||
if ! [ -f /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor.conf ]; then
|
||||
sudo cp /home/admin/assets/nginx/sites-available/rtl_tor.conf /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor.conf
|
||||
if ! [ -f /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf ]; then
|
||||
sudo cp /home/admin/assets/nginx/sites-available/rtl_tor.conf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
|
||||
fi
|
||||
if ! [ -f /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor_ssl.conf ]; then
|
||||
sudo cp /home/admin/assets/nginx/sites-available/rtl_tor_ssl.conf /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
if ! [ -f /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf ]; then
|
||||
sudo cp /home/admin/assets/nginx/sites-available/rtl_tor_ssl.conf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
fi
|
||||
|
||||
echo "# Set ports for Nginx"
|
||||
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_ssl.conf
|
||||
sudo sed -i "s/3001/$((RTLHTTP+1))/g" /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_ssl.conf
|
||||
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf
|
||||
sudo sed -i "s/3001/$((RTLHTTP+1))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf
|
||||
|
||||
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor.conf
|
||||
sudo sed -i "s/3002/$((RTLHTTP+2))/g" /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor.conf
|
||||
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
|
||||
sudo sed -i "s/3002/$((RTLHTTP+2))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
|
||||
|
||||
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
sudo sed -i "s/3003/$((RTLHTTP+3))/g" /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
sudo sed -i "s/3003/$((RTLHTTP+3))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
|
||||
sudo ln -sf /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_ssl.conf /etc/nginx/sites-enabled/
|
||||
sudo ln -sf /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor.conf /etc/nginx/sites-enabled/
|
||||
sudo ln -sf /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor_ssl.conf /etc/nginx/sites-enabled/
|
||||
sudo ln -sf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf /etc/nginx/sites-enabled/
|
||||
sudo ln -sf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf /etc/nginx/sites-enabled/
|
||||
sudo ln -sf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf /etc/nginx/sites-enabled/
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
configRTL
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^${chainprefix}${typeprefix}rtlWebinterface=.*/${chainprefix}${typeprefix}rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "s/^${netprefix}${typeprefix}rtlWebinterface=.*/${netprefix}${typeprefix}rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# Hidden Service for RTL if Tor is active
|
||||
if [ "${runBehindTor}" = "on" ]; then
|
||||
# make sure to keep in sync with internet.tor.sh script
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh ${chainprefix}${typeprefix}RTL 80 $((RTLHTTP+2)) 443 $((RTLHTTP+3))
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh ${netprefix}${typeprefix}RTL 80 $((RTLHTTP+2)) 443 $((RTLHTTP+3))
|
||||
fi
|
||||
|
||||
sudo systemctl enable ${chainprefix}${typeprefix}RTL
|
||||
echo "# OK - the ${chainprefix}${typeprefix}RTL.service is now enabled"
|
||||
sudo systemctl enable ${netprefix}${typeprefix}RTL
|
||||
echo "# OK - the ${netprefix}${typeprefix}RTL.service is now enabled"
|
||||
|
||||
source /home/admin/raspiblitz.info
|
||||
if [ "${state}" == "ready" ]; then
|
||||
echo "# OK - system is ready so starting service"
|
||||
sudo systemctl start ${chainprefix}${typeprefix}RTL
|
||||
sudo systemctl start ${netprefix}${typeprefix}RTL
|
||||
echo "# Monitor with:"
|
||||
echo "sudo journalctl -f -u ${chainprefix}${typeprefix}RTL"
|
||||
echo "sudo journalctl -f -u ${netprefix}${typeprefix}RTL"
|
||||
else
|
||||
echo "# OK - To start manually use: 'sudo systemctl start RTL'"
|
||||
fi
|
||||
@ -354,28 +354,28 @@ fi
|
||||
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^${chainprefix}${typeprefix}rtlWebinterface=.*/${chainprefix}${typeprefix}rtlWebinterface=off/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "s/^${netprefix}${typeprefix}rtlWebinterface=.*/${netprefix}${typeprefix}rtlWebinterface=off/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# remove nginx symlinks
|
||||
sudo rm -f /etc/nginx/sites-enabled/${chainprefix}${typeprefix}rtl_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-enabled/${chainprefix}${typeprefix}rtl_tor.conf
|
||||
sudo rm -f /etc/nginx/sites-enabled/${chainprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor.conf
|
||||
sudo rm -f /etc/nginx/sites-available/${chainprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-enabled/${netprefix}${typeprefix}rtl_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-enabled/${netprefix}${typeprefix}rtl_tor.conf
|
||||
sudo rm -f /etc/nginx/sites-enabled/${netprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
|
||||
sudo rm -f /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
# Hidden Service if Tor is active
|
||||
if [ "${runBehindTor}" = "on" ]; then
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh off ${chainprefix}${typeprefix}RTL
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh off ${netprefix}${typeprefix}RTL
|
||||
fi
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/${chainprefix}${typeprefix}RTL.service 2>/dev/null | grep -c "${chainprefix}${typeprefix}RTL.service")
|
||||
isInstalled=$(sudo ls /etc/systemd/system/${netprefix}${typeprefix}RTL.service 2>/dev/null | grep -c "${netprefix}${typeprefix}RTL.service")
|
||||
if [ ${isInstalled} -eq 1 ]; then
|
||||
echo "# Removing RTL for ${LNTYPE} ${CHAIN}"
|
||||
sudo systemctl disable ${chainprefix}${typeprefix}RTL
|
||||
sudo rm /etc/systemd/system/${chainprefix}${typeprefix}RTL.service
|
||||
sudo systemctl disable ${netprefix}${typeprefix}RTL
|
||||
sudo rm /etc/systemd/system/${netprefix}${typeprefix}RTL.service
|
||||
if [ $LNTYPE = cln ];then
|
||||
/home/admin/config.scripts/bonus.clnrest.sh off ${CHAIN}
|
||||
fi
|
||||
@ -385,9 +385,9 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
sudo userdel -rf rtl
|
||||
fi
|
||||
|
||||
echo "# OK ${chainprefix}${typeprefix}RTL removed."
|
||||
echo "# OK ${netprefix}${typeprefix}RTL removed."
|
||||
else
|
||||
echo "# ${chainprefix}${typeprefix}RTL is not installed."
|
||||
echo "# ${netprefix}${typeprefix}RTL is not installed."
|
||||
fi
|
||||
|
||||
# close ports on firewall
|
||||
|
@ -40,13 +40,13 @@ fi
|
||||
|
||||
# prefix for parallel testnetwork services
|
||||
if [ $NETWORK = testnet ];then
|
||||
prefix="t"
|
||||
netprefix="t"
|
||||
portprefix=1
|
||||
elif [ $NETWORK = signet ];then
|
||||
prefix="s"
|
||||
netprefix="s"
|
||||
portprefix=3
|
||||
else
|
||||
prefix=""
|
||||
netprefix=""
|
||||
portprefix=""
|
||||
fi
|
||||
|
||||
@ -54,8 +54,8 @@ echo "# Running: 'cln.install.sh $*'"
|
||||
echo "# Using the settings for: ${NETWORK} "
|
||||
|
||||
# add default value to raspi config if needed
|
||||
if ! grep -Eq "^${prefix}cln=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "${prefix}cln=off" >> /mnt/hdd/raspiblitz.conf
|
||||
if ! grep -Eq "^${netprefix}cln=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "${netprefix}cln=off" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
@ -142,8 +142,8 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = commit ]||[ "$1" = testPR ];then
|
||||
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/
|
||||
echo "# Create /home/bitcoin/.lightning/${prefix}config"
|
||||
if [ ! -f /home/bitcoin/.lightning/${prefix}config ];then
|
||||
echo "# Create /home/bitcoin/.lightning/${netprefix}config"
|
||||
if [ ! -f /home/bitcoin/.lightning/${netprefix}config ];then
|
||||
echo "
|
||||
# lightningd configuration for $NETWORK
|
||||
|
||||
@ -157,18 +157,18 @@ proxy=127.0.0.1:9050
|
||||
bind-addr=127.0.0.1:${portprefix}9736
|
||||
addr=statictor:127.0.0.1:9051
|
||||
always-use-proxy=true
|
||||
" | sudo tee /home/bitcoin/.lightning/${prefix}config
|
||||
" | sudo tee /home/bitcoin/.lightning/${netprefix}config
|
||||
else
|
||||
echo "# The file /home/bitcoin/.lightning/${prefix}config is already present"
|
||||
echo "# The file /home/bitcoin/.lightning/${netprefix}config is already present"
|
||||
#TODO look for pluging configs and clear or install
|
||||
fi
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/app-data/.lightning
|
||||
sudo chown -R bitcoin:bitcoin /home/bitcoin/
|
||||
|
||||
# systemd service
|
||||
sudo systemctl stop ${prefix}lightningd
|
||||
sudo systemctl disable ${prefix}lightningd
|
||||
echo "# Create /etc/systemd/system/${prefix}lightningd.service"
|
||||
sudo systemctl stop ${netprefix}lightningd
|
||||
sudo systemctl disable ${netprefix}lightningd
|
||||
echo "# Create /etc/systemd/system/${netprefix}lightningd.service"
|
||||
echo "
|
||||
[Unit]
|
||||
Description=c-lightning daemon on $NETWORK
|
||||
@ -178,7 +178,7 @@ User=bitcoin
|
||||
Group=bitcoin
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/lightningd\
|
||||
--conf=\"/home/bitcoin/.lightning/${prefix}config\"
|
||||
--conf=\"/home/bitcoin/.lightning/${netprefix}config\"
|
||||
KillMode=process
|
||||
Restart=always
|
||||
TimeoutSec=120
|
||||
@ -194,21 +194,21 @@ PrivateDevices=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
" | sudo tee /etc/systemd/system/${prefix}lightningd.service
|
||||
" | sudo tee /etc/systemd/system/${netprefix}lightningd.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable ${prefix}lightningd
|
||||
echo "# Enabled the ${prefix}lightningd.service"
|
||||
sudo systemctl enable ${netprefix}lightningd
|
||||
echo "# Enabled the ${netprefix}lightningd.service"
|
||||
if [ "${state}" == "ready" ]; then
|
||||
sudo systemctl start ${prefix}lightningd
|
||||
echo "# Started the ${prefix}lightningd.service"
|
||||
sudo systemctl start ${netprefix}lightningd
|
||||
echo "# Started the ${netprefix}lightningd.service"
|
||||
fi
|
||||
echo
|
||||
echo "# Adding aliases"
|
||||
echo "\
|
||||
alias ${prefix}lightning-cli=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
|
||||
--conf=/home/bitcoin/.lightning/${prefix}config\"
|
||||
alias ${prefix}cl=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
|
||||
--conf=/home/bitcoin/.lightning/${prefix}config\"
|
||||
alias ${netprefix}lightning-cli=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
|
||||
--conf=/home/bitcoin/.lightning/${netprefix}config\"
|
||||
alias ${netprefix}cl=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
|
||||
--conf=/home/bitcoin/.lightning/${netprefix}config\"
|
||||
" | sudo tee -a /home/admin/_aliases.sh
|
||||
|
||||
echo
|
||||
@ -216,33 +216,33 @@ alias ${prefix}cl=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
|
||||
echo
|
||||
echo "# To activate the aliases reopen the terminal or use:"
|
||||
echo "source ~/_aliases.sh"
|
||||
echo "# Monitor the ${prefix}lightningd with:"
|
||||
echo "sudo journalctl -fu ${prefix}lightningd"
|
||||
echo "sudo systemctl status ${prefix}lightningd"
|
||||
echo "# Monitor the ${netprefix}lightningd with:"
|
||||
echo "sudo journalctl -fu ${netprefix}lightningd"
|
||||
echo "sudo systemctl status ${netprefix}lightningd"
|
||||
echo "# logs:"
|
||||
echo "sudo tail -f /home/bitcoin/.lightning/${NETWORK}/cl.log"
|
||||
echo "# for the command line options use"
|
||||
echo "${prefix}lightning-cli help"
|
||||
echo "${netprefix}lightning-cli help"
|
||||
echo
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^${prefix}cln=.*/${prefix}cln=on/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "s/^${netprefix}cln=.*/${netprefix}cln=on/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "off" ];then
|
||||
echo "# Removing the ${prefix}lightningd.service"
|
||||
sudo systemctl disable ${prefix}lightningd
|
||||
sudo systemctl stop ${prefix}lightningd
|
||||
echo "# Removing the ${netprefix}lightningd.service"
|
||||
sudo systemctl disable ${netprefix}lightningd
|
||||
sudo systemctl stop ${netprefix}lightningd
|
||||
echo "# Removing the aliases"
|
||||
sudo sed -i "/${prefix}lightning-cli/d" /home/admin/_aliases.sh
|
||||
sudo sed -i "/${prefix}cl/d" /home/admin/_aliases.sh
|
||||
sudo sed -i "/${netprefix}lightning-cli/d" /home/admin/_aliases.sh
|
||||
sudo sed -i "/${netprefix}cl/d" /home/admin/_aliases.sh
|
||||
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
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^${prefix}cln=.*/${prefix}cln=off/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "s/^${netprefix}cln=.*/${netprefix}cln=off/g" /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
@ -13,8 +13,19 @@ if [ $1 = getvars ];then
|
||||
if [ $# -gt 1 ];then
|
||||
LNTYPE=$2
|
||||
else
|
||||
LNTYPE=lnd
|
||||
if [ ${#LNdefault} -gt 0 ];then
|
||||
LNTYPE=${LNdefault}
|
||||
else
|
||||
LNTYPE=lnd
|
||||
fi
|
||||
fi
|
||||
echo "LNTYPE=${LNTYPE}"
|
||||
if [ $LNTYPE = cln ];then
|
||||
echo "typeprefix=c"
|
||||
elif [ $LNTYPE = lnd ];then
|
||||
echo "typeprefix=''"
|
||||
fi
|
||||
|
||||
# CHAIN is signet | testnet | mainnet
|
||||
if [ $# -gt 2 ];then
|
||||
CHAIN=$3
|
||||
@ -22,21 +33,26 @@ if [ $1 = getvars ];then
|
||||
else
|
||||
CHAIN=${chain}net
|
||||
fi
|
||||
if [ ${chain} = test ];then
|
||||
echo "CHAIN=${chain}net"
|
||||
echo "chain=${chain}"
|
||||
if [ ${chain} = "test" ];then
|
||||
netprefix="t"
|
||||
echo "netprefix=t"
|
||||
L1rpcportmod=1
|
||||
L2rpcportmod=1
|
||||
elif [ ${chain} = sig ];then
|
||||
echo "portprefix=1"
|
||||
elif [ ${chain} = "sig" ];then
|
||||
netprefix="s"
|
||||
echo "netprefix=s"
|
||||
L1rpcportmod=3
|
||||
L2rpcportmod=3
|
||||
elif [ ${chain} = main ];then
|
||||
echo "portprefix=3"
|
||||
elif [ ${chain} = "main" ];then
|
||||
netprefix=""
|
||||
echo "netprefix=''"
|
||||
L1rpcportmod=""
|
||||
L2rpcportmod=0
|
||||
echo "portprefix=''"
|
||||
fi
|
||||
|
||||
#TODO ALL
|
||||
@ -47,3 +63,6 @@ if [ $1 = getvars ];then
|
||||
echo "bitcoincli_alias=\"/usr/local/bin/${network}-cli -datadir=/home/bitcoin/.${network} -rpcport=${L1rpcportmod}8332\""
|
||||
echo "lightningcli_alias=\"sudo -u bitcoin /usr/local/bin/lightning-cli --conf=/home/bitcoin/.lightning/${netprefix}config\""
|
||||
fi
|
||||
|
||||
#TODO
|
||||
#change all /lnd.conf to /${netprefix}lnd.conf
|
Loading…
Reference in New Issue
Block a user