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_baseInfo="-"
ln_channelInfo="\n" ln_channelInfo="\n"
ln_external="\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 if [ ${#ln_alias} -eq 0 ];then
ln_alias=$(echo "${ln_getInfo}" | grep '"alias":' | cut -d '"' -f4) ln_alias=$(echo "${ln_getInfo}" | grep '"alias":' | cut -d '"' -f4)
fi fi
@@ -245,7 +245,7 @@ if [ "${lightning}" == "cln" ]; then
ln_alias=${hostname} ln_alias=${hostname}
fi fi
ln_publicColor="" 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 if [ ${#ln_port} -eq 0 ]; then
ln_port=$(echo "${ln_getInfo}" | grep '"port":' | cut -d: -f2 | tail -1 | bc) ln_port=$(echo "${ln_getInfo}" | grep '"port":' | cut -d: -f2 | tail -1 | bc)
fi fi

View File

@@ -124,7 +124,7 @@ case $CHOICE in
read key read key
sudo tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log;; sudo tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log;;
CLNCONF) 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 then
whiptail \ whiptail \
--title "Restart" --yes-button "Restart" --no-button "Not now" \ --title "Restart" --yes-button "Restart" --no-button "Not now" \

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
RTLVERSION="v0.11.0" RTLVERSION="v0.11.1"
# check and load raspiblitz config # check and load raspiblitz config
# to know which network is running # to know which network is running
@@ -39,23 +39,34 @@ fi
echo "# CHAIN(${CHAIN})" echo "# CHAIN(${CHAIN})"
# prefix for parallel networks # prefix for parallel networks
if [ "${CHAIN}" == "testnet" ]; then if [ "${CHAIN}" == "mainnet" ]; then
netprefix=""
portprefix=""
CLNETWORK=${network}
elif [ "${CHAIN}" == "testnet" ]; then
netprefix="t" netprefix="t"
portprefix=1 portprefix=1
CLNETWORK=${CHAIN}
elif [ "${CHAIN}" == "signet" ]; then elif [ "${CHAIN}" == "signet" ]; then
netprefix="s" netprefix="s"
portprefix=3 portprefix=3
elif [ "${CHAIN}" == "mainnet" ]; then CLNETWORK=${CHAIN}
netprefix=""
portprefix=""
fi fi
echo "# netprefix(${netprefix})" echo "# netprefix(${netprefix})"
echo "# portprefix(${portprefix})" echo "# portprefix(${portprefix})"
echo "# CLNETWORK=${CLNETWORK}"
# prefix for parallel lightning impl # prefix for parallel lightning impl
if [ "${LNTYPE}" == "cln" ]; then if [ "${LNTYPE}" == "cln" ]; then
RTLHTTP=${portprefix}7000 RTLHTTP=${portprefix}7000
typeprefix="c" 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 elif [ "${LNTYPE}" == "lnd" ]; then
RTLHTTP=${portprefix}3000 RTLHTTP=${portprefix}3000
typeprefix="" 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 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 mv /home/rtl/${systemdService}/RTL-Config.json.tmp /home/rtl/${systemdService}/RTL-Config.json
fi fi
echo "# RTL prestart config done" echo "# RTL prestart config done"
exit 0 exit 0
fi fi

View File

@@ -260,22 +260,24 @@ elif [ "$1" = "lock" ]; then
elif [ "$1" = "encrypt" ]; then elif [ "$1" = "encrypt" ]; then
if [ -f /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info ];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) source <(sudo -u bitcoin cat /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info)
ack=0 if [ ${#seedwords6x4} -gt 0 ];then
while [ ${ack} -eq 0 ] # show the words one last time
do ack=0
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 while [ ${ack} -eq 0 ]
whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55 do
if [ $? -eq 1 ]; then 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
ack=1 whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55
fi if [ $? -eq 1 ]; then
done ack=1
fi
done
deletedWhen="deleted when the hsm_secret was encrypted"
else
deletedWhen="not available any more"
fi
# delete seedwords.info # delete seedwords.info
sudo -u bitcoin shred /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info sudo -u bitcoin shred /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
deletedWhen=" "
else
deletedWhen="not available any more"
fi fi
echo " echo "
# This file is placed by cln.hsmtool.sh . # This file is placed by cln.hsmtool.sh .

View File

@@ -11,7 +11,7 @@ fi
newName=$2 newName=$2
# use default values from the raspiblitz.conf # 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 # run interactive if 'turn on' && no further parameters
if [ ${#newName} -eq 0 ]; then if [ ${#newName} -eq 0 ]; then
@@ -31,7 +31,7 @@ fi
blitzConfig="/mnt/hdd/raspiblitz.conf" blitzConfig="/mnt/hdd/raspiblitz.conf"
# cln conf file # cln conf file
clnConfig="/home/bitcoin/.lightning/${netprefix}config" clnConfig="${CLNCONF}"
# check if raspiblitz config file exists # check if raspiblitz config file exists
if [ ! -f ${blitzConfig} ]; then if [ ! -f ${blitzConfig} ]; then