This commit is contained in:
rootzoll
2021-08-31 23:46:43 +02:00
5 changed files with 37 additions and 24 deletions

View File

@@ -237,7 +237,7 @@ if [ "${lightning}" == "cln" ]; then
ln_baseInfo="-"
ln_channelInfo="\n"
ln_external="\n"
ln_alias="$(sudo cat /home/bitcoin/.lightning/${netprefix}config | grep "^alias=*" | cut -f2 -d=)"
ln_alias="$(sudo cat "${CLNCONF}" | grep "^alias=*" | cut -f2 -d=)"
if [ ${#ln_alias} -eq 0 ];then
ln_alias=$(echo "${ln_getInfo}" | grep '"alias":' | cut -d '"' -f4)
fi
@@ -245,7 +245,7 @@ if [ "${lightning}" == "cln" ]; then
ln_alias=${hostname}
fi
ln_publicColor=""
ln_port=$(sudo cat /home/bitcoin/.lightning/${netprefix}config | grep "^bind-addr=*" | cut -f2 -d':')
ln_port=$(sudo cat "${CLNCONF}" | grep "^bind-addr=*" | cut -f2 -d':')
if [ ${#ln_port} -eq 0 ]; then
ln_port=$(echo "${ln_getInfo}" | grep '"port":' | cut -d: -f2 | tail -1 | bc)
fi

View File

@@ -124,7 +124,7 @@ case $CHOICE in
read key
sudo tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log;;
CLNCONF)
if /home/admin/config.scripts/blitz.setconf.sh "/home/bitcoin/.lightning/${netprefix}config" "root"
if /home/admin/config.scripts/blitz.setconf.sh "${CLNCONF}" "root"
then
whiptail \
--title "Restart" --yes-button "Restart" --no-button "Not now" \

View File

@@ -1,5 +1,5 @@
#!/bin/bash
RTLVERSION="v0.11.0"
RTLVERSION="v0.11.1"
# check and load raspiblitz config
# to know which network is running
@@ -39,23 +39,34 @@ fi
echo "# CHAIN(${CHAIN})"
# prefix for parallel networks
if [ "${CHAIN}" == "testnet" ]; then
if [ "${CHAIN}" == "mainnet" ]; then
netprefix=""
portprefix=""
CLNETWORK=${network}
elif [ "${CHAIN}" == "testnet" ]; then
netprefix="t"
portprefix=1
CLNETWORK=${CHAIN}
elif [ "${CHAIN}" == "signet" ]; then
netprefix="s"
portprefix=3
elif [ "${CHAIN}" == "mainnet" ]; then
netprefix=""
portprefix=""
CLNETWORK=${CHAIN}
fi
echo "# netprefix(${netprefix})"
echo "# portprefix(${portprefix})"
echo "# CLNETWORK=${CLNETWORK}"
# prefix for parallel lightning impl
if [ "${LNTYPE}" == "cln" ]; then
RTLHTTP=${portprefix}7000
typeprefix="c"
# CLNCONF is the path to the config
if [ ${CLNETWORK} = "bitcoin" ]; then
CLNCONF="/home/bitcoin/.lightning/config"
else
CLNCONF="/home/bitcoin/.lightning/${CLNETWORK}/config"
fi
echo "# CLNCONF=${CLNCONF}"
elif [ "${LNTYPE}" == "lnd" ]; then
RTLHTTP=${portprefix}3000
typeprefix=""
@@ -420,7 +431,7 @@ if [ "$1" = "prestart" ]; then
jq ".nodes[0].nodes[0].Settings.swapServerUrl = \"https://localhost:${SWAPSERVERPORT}\"" > /home/rtl/${systemdService}/RTL-Config.json.tmp
mv /home/rtl/${systemdService}/RTL-Config.json.tmp /home/rtl/${systemdService}/RTL-Config.json
fi
echo "# RTL prestart config done"
exit 0
fi

View File

@@ -260,22 +260,24 @@ elif [ "$1" = "lock" ]; then
elif [ "$1" = "encrypt" ]; then
if [ -f /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info ];then
# show the words one last time
source <(sudo -u bitcoin cat /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info)
ack=0
while [ ${ack} -eq 0 ]
do
whiptail --title "IMPORTANT SEED WORDS - PLEASE WRITE DOWN" --msgbox "The backup of seedwords will be deleted, make sure you wrote them down. Store these numbered 24 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
if [ ${#seedwords6x4} -gt 0 ];then
# show the words one last time
ack=0
while [ ${ack} -eq 0 ]
do
whiptail --title "IMPORTANT SEED WORDS - PLEASE WRITE DOWN" --msgbox "The backup of seedwords will be deleted, make sure you wrote them down. Store these numbered 24 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
deletedWhen="deleted when the hsm_secret was encrypted"
else
deletedWhen="not available any more"
fi
# delete seedwords.info
sudo -u bitcoin shred /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
deletedWhen=" "
else
deletedWhen="not available any more"
fi
echo "
# This file is placed by cln.hsmtool.sh .

View File

@@ -11,7 +11,7 @@ fi
newName=$2
# use default values from the raspiblitz.conf
source <(/home/admin/config.scripts/network.aliases.sh getvars $1)
source <(/home/admin/config.scripts/network.aliases.sh getvars cln $1)
# run interactive if 'turn on' && no further parameters
if [ ${#newName} -eq 0 ]; then
@@ -31,7 +31,7 @@ fi
blitzConfig="/mnt/hdd/raspiblitz.conf"
# cln conf file
clnConfig="/home/bitcoin/.lightning/${netprefix}config"
clnConfig="${CLNCONF}"
# check if raspiblitz config file exists
if [ ! -f ${blitzConfig} ]; then