Merge pull request #4670 from raspiblitz/dev

Update v1.11.1
This commit is contained in:
/rootzoll 2024-07-30 14:15:20 +02:00 committed by GitHub
commit b006ecb9fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
81 changed files with 2379 additions and 1413 deletions

View File

@ -1,7 +1,4 @@
contact_links:
- name: Need help? Ask a question in the Q&A section
url: https://github.com/raspiblitz/raspiblitz/discussions/categories/q-a
about: Community support for questions
- name: Have an idea for a new app in the RaspiBlitz? Make a suggestion in the app ideas section
url: https://github.com/raspiblitz/raspiblitz/discussions/categories/feature-app-ideas
about: Feature and app ideas

View File

@ -1,3 +1,27 @@
## What's new in Version 1.11.1 of RaspiBlitz?
- New: Set Timezone SSHMENU > SYSTEM > TIME [details](https://github.com/raspiblitz/raspiblitz/issues/1712)
- New: Labelbase 2.2.1 [details](https://x.com/labelbase_space)
- New: Redesign WebUI Setup & Recovery
- Update: amd64 base image: debian-12.6.0-amd64-netinst.iso
- Update: LNbits 0.12.8 [details](https://github.com/lnbits/lnbits/releases/tag/0.12.8)
- Update: Specter Desktop 2.0.4 with reactivated UPDATE option [details](https://github.com/cryptoadvance/specter-desktop/releases/tag/v2.0.4)
- Update: BTCPayServer 1.13.0 [details](https://github.com/btcpayserver/btcpayserver/releases/tag/v1.13.0)
- Update: acme.sh 3.0.7 (repair duckdns.org dyndns)
- Update: show progress of electrs building index on LCD
- Update: lndmanage 0.16.0 [details](https://github.com/bitromortac/lndmanage)
- Update: Lightning Terminal v0.12.5-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.12.5-alpha)
- Update: PyBlock 2.7.2 [details](https://github.com/curly60e/pyblock/blob/master/README.md)
- Update: Bitcoin Core 27.1 (as tested update) [details](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-27.1.md)
- Experimental: charge-lnd install script [details](https://github.com/raspiblitz/raspiblitz/discussions/3955)
- Experimental: config.scripts/lnd.signaddress.sh to easy sign messages on addresses on LND [details](https://github.com/raspiblitz/raspiblitz/issues/4540)
- Experimental: config.scripts/bonus.elements.sh install elements blockchain platform [details](https://github.com/ElementsProject/elements)
- Deprecated: Sphinx-Relay [details](https://github.com/raspiblitz/raspiblitz/issues/2558)
- Remove: AutoPilot & Keysend from SSH menus [details](https://github.com/raspiblitz/raspiblitz/issues/1953#issuecomment-1811553602)
- Remove: Tallycoin-Connect [see service shutdown](https://x.com/djbooth007/status/1784409117563720082)
- Remove: IP2Tor Shoplist [details](https://github.com/raspiblitz/raspiblitz/issues/4589)
- Remove: CopyStation Script [details](https://github.com/raspiblitz/raspiblitz/issues/4538)
## What's new in Version 1.11.0 of RaspiBlitz?
- New: RaspberryPi5 tested & enabling NVMe PCIe Hats
@ -79,7 +103,7 @@
- Update: Core Lightning v23.02.2 [details](https://github.com/ElementsProject/lightning/releases/tag/v23.02.2)
- Update: C-lightningREST v0.10.2 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.10.2)
- Update: Electrum Server in Rust (electrs) v0.9.11 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#0911-jan-5-2023)
- Update: Lightning Terminal v0.9.2-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.9.2-alpha)
- Update: Lightning Terminal v0.8.6-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.8.6-alpha)
- Update: RTL v0.13.6 with update option [details](https://github.com/Ride-The-Lightning/RTL/releases/tag/v0.13.6)
- Update: Thunderhub v0.13.16 with balance sharing disabled [details](https://github.com/apotdevin/thunderhub/releases/tag/v0.13.16)
- Update: LNbits 0.10.6 [details](https://github.com/lnbits/lnbits/releases/tag/0.10.6)

View File

@ -369,7 +369,7 @@ echo -e "\n*** SOFTWARE UPDATE ***"
# sqlite3 -> database
# fdisk -> create partitions
# lsb-release -> needed to know which distro version we're running to add APT sources
general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release smartmontools rsyslog"
general_utils="sudo policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release smartmontools rsyslog resolvconf"
# add btrfs-progs if not bookworm on aarch64
[ "${architecture}" = "aarch64" ] && ! grep "12 (bookworm)" < /etc/os-release && general_utils="${general_utils} btrfs-progs"
# python3-mako --> https://github.com/rootzoll/raspiblitz/issues/3441
@ -664,18 +664,19 @@ echo -e "\n*** ADDING GROUPS FOR CREDENTIALS STORE ***"
echo -e "\n*** SHELL SCRIPTS & ASSETS ***"
# copy raspiblitz repo from github
cd /home/admin/ || exit 1
sudo -u admin git config --global user.name "${github_user}"
sudo -u admin git config --global user.email "johndoe@example.com"
sudo -u admin git config --global user.name "${github_user}" || exit 1
sudo -u admin git config --global user.email "johndoe@example.com" || exit 1
sudo -u admin git config --global http.postBuffer 524288000 || exit 1
sudo -u admin rm -rf /home/admin/raspiblitz
sudo -u admin git clone -b "${branch}" https://github.com/${github_user}/raspiblitz.git
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/*.* /home/admin
sudo -u admin cp /home/admin/raspiblitz/home.admin/.tmux.conf /home/admin
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/
sudo -u admin chmod +x *.sh
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/setup.scripts /home/admin/
sudo -u admin chmod +x /home/admin/setup.scripts/*.sh
sudo -u admin git clone -b "${branch}" https://github.com/${github_user}/raspiblitz.git || exit 1
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/*.* /home/admin || exit 1
sudo -u admin cp /home/admin/raspiblitz/home.admin/.tmux.conf /home/admin || exit 1
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/ || exit 1
sudo -u admin chmod +x *.sh || exit 1
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/ || exit 1
sudo -u admin chmod +x /home/admin/config.scripts/*.sh || exit 1
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/setup.scripts /home/admin/ || exit 1
sudo -u admin chmod +x /home/admin/setup.scripts/*.sh || exit 1
# install newest version of BlitzPy
blitzpy_wheel=$(ls -tR /home/admin/raspiblitz/home.admin/BlitzPy/dist | grep -E "any.whl" | tail -n 1)

View File

@ -1,5 +1,5 @@
variable "iso_name" { default = "debian-12.5.0-amd64-netinst.iso" }
variable "iso_checksum" { default = "013f5b44670d81280b5b1bc02455842b250df2f0c6763398feb69af1a805a14f" }
variable "iso_name" { default = "debian-12.6.0-amd64-netinst.iso" }
variable "iso_checksum" { default = "ade3a4acc465f59ca2496344aab72455945f3277a52afc5a2cae88cdc370fa12" }
variable "pack" { default = "lean" }
variable "github_user" { default = "raspiblitz" }

View File

@ -1,9 +1,14 @@
#!/bin/sh -eux
# Disable Predictable Network Interface names and use eth0
sed -i 's/en[[:alnum:]]*/eth0/g' /etc/network/interfaces;
sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 \1"/g' /etc/default/grub;
update-grub;
sed -i 's/en[[:alnum:]]*/eth0/g' /etc/network/interfaces
sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 \1"/g' /etc/default/grub
update-grub
# Adding a 2 sec delay to the interface up, to make the dhclient happy
echo "pre-up sleep 2" >> /etc/network/interfaces
echo "pre-up sleep 2" >>/etc/network/interfaces
# needed for resolvconf installed in build_sdcard.sh
apt-get install resolvconf -y
echo 'nameserver 1.1.1.1' >/etc/resolv.conf
echo 'nameserver 8.8.8.8' >>/etc/resolv.conf

View File

@ -19,6 +19,7 @@ source <(/home/admin/_cache.sh get \
system_ups_status \
system_ups_battery \
system_cpu_load \
system_up_text \
system_temp_celsius \
system_temp_fahrenheit \
runBehindTor \
@ -311,7 +312,8 @@ if [ "${blitzapi}" == "on" ]; then
webuiinfo="Web Admin --> http://${internet_localip}"
fi
datetime=$(date -R)
datetime=$(date +"%d %b %T %z")
datetime="${datetime} up ${system_up_text}"
stty sane
sleep 1
@ -353,18 +355,20 @@ else
appInfoLine=""
# Electrum Server - electrs
if [ "${ElectRS}" == "on" ]; then
fileFlagExists=$(sudo ls /mnt/hdd/app-storage/electrs/initial-sync.done 2>/dev/null | grep -c 'initial-sync.done')
if [ "${ElectRS}" == "on" ] && [ $fileFlagExists -eq 0 ]; then
error=""
source <(sudo /home/admin/config.scripts/bonus.electrs.sh status-sync 2>/dev/null)
source <(/home/admin/config.scripts/bonus.electrs.sh status-sync 2>/dev/null)
if [ ${#infoSync} -gt 0 ]; then
appInfoLine="Electrum: ${infoSync}"
fi
fi
# Electrum Server - fulcrum
if [ "${fulcrum}" == "on" ]; then
fileFlagExists=$(sudo ls /mnt/hdd/app-storage/fulcrum/initial-sync.done 2>/dev/null | grep -c 'initial-sync.done')
if [ "${fulcrum}" == "on" ] && [ $fileFlagExists -eq 0 ]; then
error=""
source <(sudo /home/admin/config.scripts/bonus.fulcrum.sh status-sync 2>/dev/null)
source <(/home/admin/config.scripts/bonus.fulcrum.sh status-sync 2>/dev/null)
if [ ${#infoSync} -gt 0 ]; then
appInfoLine="Fulcrum: ${infoSync}"
fi

View File

@ -93,7 +93,7 @@ while :
source <(/home/admin/config.scripts/network.aliases.sh getvars)
fi
if [ "${setupPhase}" != "done" ] || [ "${state}" == "reboot" ] || [ "${state}" == "shutdown" ] || [ "${state}" == "copytarget" ] || [ "${state}" == "copysource" ] || [ "${state}" == "copystation" ]; then
if [ "${setupPhase}" != "done" ] || [ "${state}" == "reboot" ] || [ "${state}" == "shutdown" ] || [ "${state}" == "copytarget" ] || [ "${state}" == "copysource" ]; then
# show status info during boot & setup & repair on LCD
if [ "${state}" == "" ]; then

View File

@ -159,9 +159,6 @@ fi
if [ "${circuitbreaker}" == "on" ]; then
OPTIONS+=(CIRCUITBREAKER "Circuitbreaker (LND firewall)")
fi
if [ "${tallycoinConnect}" == "on" ]; then
OPTIONS+=(TALLY "Tallycoin Connect")
fi
if [ "${squeaknode}" == "on" ]; then
OPTIONS+=(SQUEAKNODE "Squeaknode")
fi
@ -171,6 +168,9 @@ fi
if [ "${fints}" == "on" ]; then
OPTIONS+=(FINTS "Show FinTS/HBCI details")
fi
if [ "${labelbase}" == "on" ]; then
OPTIONS+=(LABELBASE "Labelbase (UTXO labeling)")
fi
# dont offer to switch to "testnet view for now" - so no wswitch back to mainnet needed
#if [ ${chain} != "main" ]; then
@ -310,9 +310,6 @@ case $CHOICE in
THUB)
sudo /home/admin/config.scripts/bonus.thunderhub.sh menu
;;
TALLY)
sudo /home/admin/config.scripts/bonus.tallycoin-connect.sh menu
;;
ZEROTIER)
sudo /home/admin/config.scripts/bonus.zerotier.sh menu
;;
@ -334,6 +331,9 @@ case $CHOICE in
CIRCUITBREAKER)
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
;;
LABELBASE)
sudo /home/admin/config.scripts/bonus.labelbase.sh menu
;;
FINTS)
sudo /home/admin/config.scripts/bonus.fints.sh menu
;;

View File

@ -47,14 +47,6 @@ if [ "${copyInProgress}" = "1" ]; then
exit
fi
# special state: copystation
if [ "${state}" = "copystation" ]; then
echo "Copy Station is Running ..."
echo "reboot to return to normal"
sudo /home/admin/XXcopyStation.sh
exit
fi
#####################################
# SSH MENU LOOP
# this loop runs until user exits or
@ -98,8 +90,7 @@ do
network \
chain \
lightning \
internet_localip \
system_vm_vagrant \
internet_localip
)
# background.scan is not ready yet
@ -186,11 +177,17 @@ do
sleep 3
continue
fi
else
elif [ "${lightning}" = "lnd" ]; then
if [ "${btc_default_synced}" != "1" ] || [ "${ln_default_ready}" == "0" ] || [ "${ln_default_sync_chain}" == "0" ] || [ "${ln_default_sync_initial_done}" == "0" ]; then
/home/admin/setup.scripts/eventBlockchainSync.sh ssh
sleep 3
continue
fi
else
if [ "${btc_default_synced}" != "1" ]; then
/home/admin/setup.scripts/eventBlockchainSync.sh ssh
sleep 3
continue
fi
fi
fi
@ -281,25 +278,6 @@ MAINMENU > REPAIR > REPAIR-LND > RETRYSCB
#echo "# DURING SETUP: Handle System State (${state})"
# when no HDD on Vagrant - just print info & exit (admin info & exit)
if [ "${state}" == "noHDD" ] && [ ${system_vm_vagrant} != "0" ]; then
echo "***********************************************************"
echo "VAGRANT INFO"
echo "***********************************************************"
echo "To connect a HDD data disk to your VagrantVM:"
echo "- shutdown VM with command: off"
echo "- open your VirtualBox GUI and select RaspiBlitzVM"
echo "- change the 'mass storage' settings"
echo "- add a second 'Primary Slave' drive to the already existing controller"
echo "- close VirtualBox GUI and run: vagrant up & vagrant ssh"
echo "***********************************************************"
echo "You can either create a new dynamic VDI with around 900GB or download"
echo "a VDI with a presynced blockchain to speed up setup. If you dont have 900GB"
echo "space on your laptop you can store the VDI file on an external drive."
echo "***********************************************************"
exit 1
fi
# for all critical errors (admin info & exit)
if [ "${state}" == "error" ] || [ "${state}" == "errorHDD" ]; then
clear

View File

@ -6,7 +6,6 @@ source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
echo "services default values"
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 [ ${#networkUPnP} -eq 0 ]; then networkUPnP="off"; fi
@ -70,14 +69,6 @@ if [ ${touchscreen} -gt 0 ]; then
touchscreenMenu='on'
fi
echo "# map autopilot to on/off"
lndAutoPilotOn=$(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep -c 'autopilot.active=1')
if [ ${lndAutoPilotOn} -eq 1 ]; then
autoPilot="on"
else
autoPilot="off"
fi
echo "# map clboss to on/off"
clbossMenu='off'
if [ "${clboss}" == "on" ]; then
@ -102,13 +93,6 @@ if [ "${clWatchtowerClient}" == "on" ]; then
clWatchtowerClientMenu='on'
fi
echo "# map keysend to on/off (may take time)"
keysend="on"
source <(sudo /home/admin/config.scripts/lnd.keysend.sh status)
if [ ${keysendOn} -eq 0 ]; then
keysend="off"
fi
# show select dialog
echo "run dialog ..."
@ -119,7 +103,7 @@ OPTIONS+=(A 'Blitz API + WebUI' ${blitzapi})
# LCD options (only when running with LCD screen)
if [ "${displayClass}" == "lcd" ]; then
OPTIONS+=(s 'Touchscreen (experimental)' ${touchscreenMenu})
# OPTIONS+=(s 'Touchscreen (experimental)' ${touchscreenMenu})
OPTIONS+=(r 'LCD Rotate' ${lcdrotateMenu})
fi
@ -143,8 +127,6 @@ fi
# LND & options (only when running LND)
OPTIONS+=(m 'LND LIGHTNING LABS NODE' ${lndNode})
if [ "${lndNode}" == "on" ]; then
OPTIONS+=(a '-LND Channel Autopilot' ${autoPilot})
OPTIONS+=(k '-LND Accept Keysend' ${keysend})
OPTIONS+=(c '-LND Circuitbreaker (firewall)' ${circuitbreaker})
OPTIONS+=(u '-LND Auto-Unlock' ${autoUnlock})
fi
@ -198,18 +180,6 @@ else
echo "Blitz API + webUI Setting unchanged."
fi
# LND AUTOPILOT process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "a")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${autoPilot}" != "${choice}" ] && [ "${lndNode}" == "on" ]; then
echo "Autopilot Setting changed .."
anychange=1
sudo /home/admin/config.scripts/lnd.autopilot.sh ${choice}
needsReboot=1
else
echo "Autopilot Setting unchanged."
fi
# Dynamic Domain
choice="off"; check=$(echo "${CHOICES}" | grep -c "y")
if [ ${check} -eq 1 ]; then choice="on"; fi
@ -355,20 +325,6 @@ else
echo "BackupdDevice setting unchanged."
fi
# LND Keysend process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "k")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${keysend}" != "${choice}" ] && [ "${lndNode}" == "on" ]; then
echo "keysend setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/lnd.keysend.sh ${choice}
sudo systemctl restart lnd
dialog --msgbox "Accept Keysend on LND mainnet is now ${choice}.\n\nLND restarted - you might need to unlock wallet." 7 52
sudo -u admin /home/admin/config.scripts/lnd.unlock.sh
else
echo "keysend setting unchanged."
fi
# ZeroTier process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "z")
if [ ${check} -eq 1 ]; then choice="on"; fi

View File

@ -26,11 +26,11 @@ if [ ${#lit} -eq 0 ]; then lit="off"; fi
if [ ${#lndg} -eq 0 ]; then lndg="off"; fi
if [ ${#whitepaper} -eq 0 ]; then whitepaper="off"; fi
if [ ${#chantools} -eq 0 ]; then chantools="off"; fi
if [ ${#tallycoinConnect} -eq 0 ]; then tallycoinConnect="off"; fi
if [ ${#helipad} -eq 0 ]; then helipad="off"; fi
if [ ${#lightningtipbot} -eq 0 ]; then lightningtipbot="off"; fi
if [ ${#fints} -eq 0 ]; then fints="off"; fi
if [ ${#lndk} -eq 0 ]; then lndk="off"; fi
if [ ${#labelbase} -eq 0 ]; then labelbase="off"; fi
# show select dialog
echo "run dialog ..."
@ -47,6 +47,7 @@ if [ "${network}" == "bitcoin" ]; then
OPTIONS+=(ja 'BTC JoinMarket+JoininBox menu' ${joinmarket})
OPTIONS+=(za 'BTC Jam (JoinMarket WebUI)' ${jam})
OPTIONS+=(wa 'BTC Download Bitcoin Whitepaper' ${whitepaper})
OPTIONS+=(ls 'BTC Labelbase' ${labelbase})
fi
# available for both LND & c-lightning
@ -64,9 +65,7 @@ if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
OPTIONS+=(oa 'LND Balance of Satoshis' ${bos})
OPTIONS+=(ya 'LND PyBLOCK' ${pyblock})
OPTIONS+=(ha 'LND ChannelTools (Fund Rescue)' ${chantools})
OPTIONS+=(xa 'LND Sphinx-Relay' ${sphinxrelay})
OPTIONS+=(fa 'LND Helipad Boostagram reader' ${helipad})
OPTIONS+=(da 'LND Tallycoin Connect' ${tallycoinConnect})
OPTIONS+=(lb 'LND LNDK (experimental BOLT 12)' ${lndk})
fi
@ -451,25 +450,6 @@ else
echo "LNDg unchanged."
fi
# Sphinx Relay
choice="off"; check=$(echo "${CHOICES}" | grep -c "xa")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${sphinxrelay}" != "${choice}" ]; then
echo "Sphinx-Relay Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.sphinxrelay.sh ${choice}
if [ "${choice}" = "on" ]; then
echo "Giving service 1 minute to start up ... (please wait) ..."
sleep 60
whiptail --title " Installed Sphinx Server" --msgbox "\
Sphinx Server was installed.\n
Use the new 'SPHINX' entry in Main Menu for more info.\n
" 10 35
fi
else
echo "Sphinx Relay unchanged."
fi
# Helipad
choice="off"; check=$(echo "${CHOICES}" | grep -c "fa")
if [ ${check} -eq 1 ]; then choice="on"; fi
@ -485,23 +465,6 @@ else
echo "Helipad setting unchanged."
fi
# Tallycoin
choice="off"; check=$(echo "${CHOICES}" | grep -c "da")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${tallycoinConnect}" != "${choice}" ]; then
echo "Tallycoin Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.tallycoin-connect.sh ${choice}
if [ "${choice}" = "on" ]; then
whiptail --title " Installed Tallycoin-Connect" --msgbox "\
Tallycoin-Connect was installed.\n
Use the new 'TALLY' entry in Main Menu for more info.\n
" 10 45
fi
else
echo "Tallycoin Setting unchanged."
fi
# LNDK
choice="off"; check=$(echo "${CHOICES}" | grep -c "lb")
if [ ${check} -eq 1 ]; then choice="on"; fi
@ -618,6 +581,21 @@ else
echo "Whitepaper setting unchanged."
fi
# labelbase process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "ls")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${labelbase}" != "${choice}" ]; then
echo "Labelbase setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.labelbase.sh ${choice}
source /mnt/hdd/raspiblitz.conf
if [ "${labelbase}" = "on" ]; then
sudo -u admin /home/admin/config.scripts/bonus.labelbase.sh menu
fi
else
echo "Labelbase setting unchanged."
fi
# fints process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "fn")
if [ ${check} -eq 1 ]; then choice="on"; fi

View File

@ -147,12 +147,12 @@ Or scan the qr code on the LCD with your mobile phone.
SENDMANY_ANDROID)
# check if keysend is activated first
source <(/home/admin/config.scripts/lnd.keysend.sh status)
keysendOn=$(cat /mnt/hdd/lnd/lnd.conf | grep -c '^accept-keysend=1')
if [ "${keysendOn}" == "0" ]; then
whiptail --title " KEYSEND NEEDED " --msgbox "
whiptail --title " LND KEYSEND NEEDED " --msgbox "
To use the chat feature of the SendMany app, you need to activate the Keysend feature first.
Please go to MAINMENU > SERVICES and activate KEYSEND first.
Please go to MAINMENU > SYSTEM > LNDCONF and set accept-keysend=1 first.
" 12 65
exit 0
fi

View File

@ -66,7 +66,7 @@ RaspiBlitz image to your SD card.
}
# get status of txindex
source <(/home/admin/config.scripts/network.txindex.sh status)
source <(sudo /home/admin/config.scripts/network.txindex.sh status)
OPTIONS=()
#OPTIONS+=(HARDWARE "Run Hardwaretest")

View File

@ -56,7 +56,7 @@ CHOICE=$(dialog --clear \
case $CHOICE in
SUMMARY)
clear
/home/admin/config.scripts/cl-plugin.summary.sh $CHAIN
/home/admin/config.scripts/cl-plugin.summars.sh $CHAIN
echo "Press ENTER to return to main menu."
read key
;;

View File

@ -16,6 +16,8 @@ MENU="" # adds lines to HEIGHT
OPTIONS=() # adds lines to HEIGHt + CHOICE_HEIGHT
OPTIONS+=(BTOP "Monitor system resources with btop")
OPTIONS+=(TIME "Set Timezone")
OPTIONS+=(${network}LOG "Monitor the debug.log for ${CHAIN}")
OPTIONS+=(${network}CONF "Edit the bitcoin.conf")
@ -57,6 +59,9 @@ case $CHOICE in
# run as root to allow signal sending to any process
sudo btop
;;
TIME)
sudo /home/admin/config.scripts/blitz.time.sh choose-timezone
;;
${network}LOG)
if [ ${CHAIN} = signet ]; then
bitcoinlogpath="/mnt/hdd/bitcoin/signet/debug.log"

View File

@ -80,7 +80,7 @@ Once the LCD is white and no LEDs are blinking anymore:
- Remove the Power from RaspiBlitz
- Exchange the old with the new SD card
- Connect Power back to the RaspiBlitz
- Follow the instructions on the LCD
- Login again per SSH or WebUI
Do you have the SD card with the new version image ready
and do you WANT TO START UPDATE NOW?
@ -269,7 +269,28 @@ Do you really want to update LND now?
if [ ${#error} -gt 0 ]; then
whiptail --title "ERROR" --msgbox "${error}" 8 30
else
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
whiptail \
--title " LND update " \
--yes-button "Reboot" \
--no-button "Skip Reboot" \
--yesno \
"OK LND update is done.
By default a reboot is advised to sync macaroons and the TLS certificate.
Consider rebooting later manually if encountering any problems.
" 12 50
if [ $? -eq 0 ]; then
clear
echo "# REBOOT .."
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
sleep 8
exit 1
else
echo "# SKIP REBOOT"
echo "# starting the lnd.service .."
sudo systemctl start lnd
exit 0
fi
sleep 8
fi
;;
@ -293,7 +314,28 @@ Do you really want to update LND now?
if [ ${#error} -gt 0 ]; then
whiptail --title "ERROR" --msgbox "${error}" 8 30
else
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
whiptail \
--title " LND update " \
--yes-button "Reboot" \
--no-button "Skip Reboot" \
--yesno \
"OK LND update is done.
By default a reboot is advised to sync macaroons and the TLS certificate.
Consider rebooting later manually if encountering any problems.
" 12 50
if [ $? -eq 0 ]; then
clear
echo "# REBOOT .."
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
sleep 8
exit 1
else
echo "# SKIP REBOOT"
echo "# starting the lnd.service .."
sudo systemctl start lnd
exit 0
fi
sleep 8
fi
;;
@ -418,7 +460,28 @@ Do you really want to update Bitcoin Core now?
error=""
warn=""
sudo -u admin /home/admin/config.scripts/bitcoin.update.sh tested
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
whiptail \
--title " Bitcoin Core update " \
--yes-button "Reboot" \
--no-button "Skip Reboot" \
--yesno \
"OK Bitcoin Core update is done.
By default a reboot is advised.
" 9 40
if [ $? -eq 0 ]; then
clear
echo "# REBOOT .."
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
sleep 8
exit 1
else
echo "# SKIP REBOOT"
echo "# starting the bitcoind.service .."
sudo systemctl start bitcoind
exit 0
fi
sleep 8
;;
RECKLESS)
whiptail --title "UNTESTED Bitcoin Core update to ${bitcoinLatestVersion}" --yes-button "Cancel" \
@ -439,11 +502,53 @@ Do you really want to update Bitcoin Core now?
if [ ${#error} -gt 0 ]; then
whiptail --title "ERROR" --msgbox "${error}" 8 30
fi
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
whiptail \
--title " Bitcoin Core update " \
--yes-button "Reboot" \
--no-button "Skip Reboot" \
--yesno \
"OK Bitcoin Core update is done.
By default a reboot is advised.
" 9 40
if [ $? -eq 0 ]; then
clear
echo "REBOOT .."
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
sleep 8
exit 1
else
echo "# SKIP REBOOT"
echo "# starting the bitcoind.service .."
sudo systemctl start bitcoind
exit 0
fi
sleep 8
;;
CUSTOM)
sudo -u admin /home/admin/config.scripts/bitcoin.update.sh custom
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
whiptail \
--title " Bitcoin Core update " \
--yes-button "Reboot" \
--no-button "Skip Reboot" \
--yesno \
"OK Bitcoin Core update is done.
By default a reboot is advised.
" 9 40
if [ $? -eq 0 ]; then
clear
echo "# REBOOT .."
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
sleep 8
exit 1
else
echo "# SKIP REBOOT"
echo "# starting the bitcoind.service .."
sudo systemctl start bitcoind
exit 0
fi
sleep 8
;;
esac
}
@ -490,9 +595,9 @@ if [ "${lndg}" == "on" ]; then
fi
## Disabled for now until the base image has Python 3.10
#if [ "${specter}" == "on" ]; then
# OPTIONS+=(SPECTER "Update Specter Desktop")
#fi
if [ "${specter}" == "on" ]; then
OPTIONS+=(SPECTER "Update Specter Desktop")
fi
if [ "${BTCPayServer}" == "on" ]; then
OPTIONS+=(BTCPAY "Update BTCPayServer")

View File

@ -682,7 +682,7 @@ adjectives = [
"picky",
"pied",
"piggy",
"pilar",
"pillar",
"pink",
"plain",
"plane",

View File

@ -648,7 +648,7 @@ piano
picky
pied
piggy
pilar
pillar
pink
plain
plane

View File

@ -1,296 +0,0 @@
#!/bin/bash
# command info
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# Turns the RaspiBlitz into HDD CopyStation Mode"
echo "# lightning is deactivated during CopyStationMode"
echo "# reboot RaspiBlitz to set back to normal mode"
exit 1
fi
####### CONFIG #############
# where to find the BITCOIN data directory (no trailing /)
pathBitcoinBlockchain="/mnt/hdd/bitcoin"
# where to find the RaspiBlitz HDD template directory (no trailing /)
pathTemplateHDD="/mnt/hdd/app-storage/templateHDD"
####### SCRIPT #############
# check sudo
if [ "$EUID" -ne 0 ]; then
echo "Please run as root (with sudo)"
exit 1
fi
# get HDD info
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
# check if HDD is mounted
if [ ${isMounted} -eq 0 ]; then
echo "error='HDD is not mounted'"
exit 1
fi
# check if HDD is big enough
if [ ${hddGigaBytes} -lt 800 ]; then
echo "# To run copy station (+/- 1TB needed)"
echo "error='HDD is too small'"
exit 1
fi
# check that path information is valid
if [ -d "$pathBitcoinBlockchain" ]; then
echo "# OK found $pathBitcoinBlockchain"
else
echo "# FAIL path of 'pathBitcoinBlockchain' does not exists: ${pathBitcoinBlockchain}"
echo "error='pathBitcoinBlockchain not found'"
exit 1
fi
# make sure that its running in screen
# call with '-foreground' to prevent running in screen
if [ "$1" != "-foreground" ]; then
screenPID=$(screen -ls | grep "copystation" | cut -d "." -f1 | xargs)
if [ ${#screenPID} -eq 0 ]; then
# start copystation in screen
echo "# starting copystation screen session"
screen -S copystation -dm /home/admin/XXcopyStation.sh -foreground
screen -d -r
exit 0
else
echo "# changing into running copystation screen session"
screen -d -r
exit 0
fi
fi
clear
echo "# ******************************"
echo "# RASPIBLITZ COPYSTATION SCRIPT"
echo "# ******************************"
echo
echo "Make sure that no target HDD/SSDs are not connected yet .."
echo
sudo sed -i "s/^state=.*/state=copystation/g" /home/admin/raspiblitz.info 2>/dev/null
sleep 10
echo "*** CHECKING CONFIG"
# check that path information is valid
if [ -d "$pathTemplateHDD" ]; then
echo "# OK found $pathTemplateHDD"
else
echo "# Creating: ${pathTemplateHDD}"
mkdir ${pathTemplateHDD}
chmod 777 ${pathTemplateHDD}
fi
# make sure that lnd is stopped (if running)
systemctl stop lnd 2>/dev/null
systemctl stop background 2>/dev/null
# finding system drives (the drives that should not be synced to)
echo "# OK - the following drives detected as the system drive: $datadisk"
echo
# BASIC IDEA:
# 1. get fresh data from bitcoind --> template data
# 2. detect HDDs
# 3. sync HDDs with template data
# repeat
echo
echo "*** RUNNING ***"
lastBlockchainUpdateTimestamp=1
firstLoop=1
while :
do
# reset external data stores (needed because local vars dont work in deeper while loops)
echo "" > /var/cache/raspiblitz/copystationHddsInfoString.tmp
rm /var/cache/raspiblitz/copystationFoundTargets.flag
################################################
# 1. get fresh data from bitcoind for template data (skip on first loop)
# only execute every 30min
nowTimestamp=$(date +%s)
secondsDiff=$(echo "${nowTimestamp}-${lastBlockchainUpdateTimestamp}" | bc)
echo "# seconds since last update from bitcoind: ${secondsDiff}"
echo
if [ ${secondsDiff} -gt 3000 ]; then
echo "******************************"
echo "Bitcoin Blockchain Update"
echo "******************************"
# stop blockchains
echo "# Stopping Blockchain ..."
systemctl stop bitcoind 2>/dev/null
sleep 10
# sync bitcoin
echo "# Syncing Bitcoin to template folder ..."
/home/admin/_cache.sh set message "Updating Template: Bitcoin"
# make sure the bitcoin directory in template folder exists
if [ ! -d "$pathTemplateHDD/bitcoin" ]; then
echo "# creating the bitcoin subfolder in the template folder"
mkdir ${pathTemplateHDD}/bitcoin
chmod 777 ${pathTemplateHDD}/bitcoin
fi
# do the sync to the template folder for BITCOIN
rsync -a --info=progress2 --delete ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathTemplateHDD}/bitcoin
# restart bitcoind (to let further setup while syncing HDDs)
echo "# Restarting Blockchain ..."
systemctl start bitcoind 2>/dev/null
# update timer
lastBlockchainUpdateTimestamp=$(date +%s)
fi
################################################
# 2. detect connected HDDs and loop thru them
echo
echo "**************************************"
echo "SYNCING TEMPLATE -> CONNECTED HDD/SSDs"
echo "**************************************"
sleep 2
lsblk -o NAME | grep "^[s|v]d" | while read -r detectedDrive ; do
isSystemDrive=$(echo "${datadisk}" | grep -c "${detectedDrive}")
if [ ${isSystemDrive} -eq 0 ]; then
# remember that disks were found
touch /var/cache/raspiblitz/copystationFoundTargets.flag
# check if drives 1st partition is named BLOCKCHAIN & in EXT4 format
isNamedBlockchain=$(lsblk -o NAME,FSTYPE,LABEL | grep "${detectedDrive}" | grep -c "BLOCKCHAIN")
isFormatExt4=$(lsblk -o NAME,FSTYPE,LABEL | grep "${detectedDrive}" | grep -c "ext4")
# init a fresh device
if [ ${isNamedBlockchain} -eq 0 ] || [ ${isFormatExt4} -eq 0 ]; then
echo
echo "**************************************************************"
echo "*** NEW EMPTY HDD FOUND ---> ${detectedDrive}"
echo "isNamedBlockchain: ${isNamedBlockchain}"
echo "isFormatExt4:" ${isFormatExt4}
# check if size is OK
size=$(lsblk -o NAME,SIZE -b | grep "^${detectedDrive}" | awk '$1=$1' | cut -d " " -f 2)
echo "size: ${size}"
if [ ${size} -lt 900000000000 ]; then
echo "# THE HDD/SSD IS TOO SMALL <900GB - use at least 1TB"
/home/admin/_cache.sh set message "HDD smaller than 1TB: ${detectedDrive}"
echo
sleep 10
else
choice=0
/home/admin/_cache.sh set message "Formatting new HDD: ${detectedDrive}"
# format the HDD
echo "Starting Formatting of device ${detectedDrive} ..."
/home/admin/config.scripts/blitz.datadrive.sh format ext4 ${detectedDrive}
sleep 4
fi
else
echo
echo "*** ALREADY ACTIVE HDD FOUND ---> ${detectedDrive}"
sleep 1
fi
################################################
# 3. sync HDD with template data (skip on first loop)
partition=$(lsblk -o NAME,FSTYPE,LABEL | grep "${detectedDrive}" | grep "BLOCKCHAIN" | cut -d ' ' -f 1 | tr -cd "[:alnum:]")
if [ "${firstLoop}" != "1" ] && [ ${#partition} -gt 0 ]; then
# temp mount device
echo "mounting: ${partition}"
mkdir /mnt/hdd2 2>/dev/null
mount -t ext4 /dev/${partition} /mnt/hdd2
# rsync device
mountOK=$(lsblk -o NAME,MOUNTPOINT | grep "${detectedDrive}" | grep -c "/mnt/hdd2")
if [ ${mountOK} -eq 1 ]; then
hddsInfoString=$(cat /var/cache/raspiblitz/copystationHddsInfoString.tmp | tr '\n' ' ')
/home/admin/_cache.sh set message "${hddsInfoString} ${partition}>SYNC"
rsync -a --info=progress2 --delete ${pathTemplateHDD}/* /mnt/hdd2
chmod -R 777 /mnt/hdd2
rm -r /mnt/hdd2/lost+found 2>/dev/null
echo "${partition}>OK" >> /var/cache/raspiblitz/copystationHddsInfoString.tmp
else
echo "# FAIL: was not able to mount --> ${partition}"
fi
# unmount device
umount -l /mnt/hdd2
fi
fi
done
# check for flag
foundTargets=$(ls /var/cache/raspiblitz/copystationFoundTargets.flag 2>/dev/null | grep -c "copystationFoundTargets.flag")
hddsInfoString=$(cat /var/cache/raspiblitz/copystationHddsInfoString.tmp | tr '\n' ' ')
clear
if [ "${foundTargets}" == "1" ] && [ "${firstLoop}" == "1" ]; then
# after script found discs and did formatting ... go into full loop
echo "OK first loop done ..."
firstLoop=0
sleep 1
elif [ "${foundTargets}" == "0" ]; then
echo "**** NO TARGET HDD/SSDs CONNECTED ****"
echo
echo "Best way to start a new batch:"
echo "- Disconnect powered USB-Hub (best unplug USB cable at USB-Hub)"
echo "- Connect all HDD/SSDs to the disconnected USB-Hub"
echo "- Connect powered USB-Hub to Blitz (plug USB cable in)"
echo "- During formatting remember names of physical HDD/SSDs"
echo "- As soon as you see an OK for that HDD/SSD name you can remove it"
echo
echo "Next round starts in 30 seconds ..."
echo "To stop copystation script: CTRL+c and then 'restart'"
echo "You can close SSH terminal and script will run in background can can be re-entered."
/home/admin/_cache.sh set message "No target HDDs connected - connect USB Hub"
firstLoop=1
sleep 30
else
echo "**** SYNC LOOP DONE ****"
echo "HDDs ready synced:"
cat /var/cache/raspiblitz/copystationHddsInfoString.tmp
echo
echo "*************************"
echo
echo "Next round starts in 25 seconds ..."
echo "To stop copystation script: CTRL+c and then 'restart'"
echo "You can close SSH terminal and script will run in background can can be re-entered."
/home/admin/_cache.sh set message "Ready HDDs: ${hddsInfoString}"
sleep 25
fi
clear
echo "starting new sync loop"
sleep 5
done

View File

@ -105,25 +105,11 @@ fi
echo "importing: _version.info"
/home/admin/_cache.sh import /home/admin/_version.info
# basic hardware info (will not change)
source <(/home/admin/_cache.sh valid \
system_board \
system_ram_mb \
system_ram_gb \
)
if [ "${stillvalid}" == "0" ]; then
source <(/home/admin/config.scripts/blitz.hardware.sh status)
/home/admin/_cache.sh set system_board "${board}"
/home/admin/_cache.sh set system_ram_mb "${ramMB}"
/home/admin/_cache.sh set system_ram_gb "${ramGB}"
fi
# VM detect vagrant
source <(/home/admin/_cache.sh valid system_vm_vagrant)
if [ "${stillvalid}" == "0" ]; then
vagrant=$(df | grep -c "/vagrant")
/home/admin/_cache.sh set system_vm_vagrant "${vagrant}"
fi
# get hardware info
source <(/home/admin/config.scripts/blitz.hardware.sh status)
/home/admin/_cache.sh set system_board "${board}"
/home/admin/_cache.sh set system_ram_mb "${ramMB}"
/home/admin/_cache.sh set system_ram_gb "${ramGB}"
# flag that init was done (will be checked on each loop)
/home/admin/_cache.sh set system_init_time "$(date +%s)"
@ -155,7 +141,9 @@ do
# uptime just do on every run
system_up=$(cat /proc/uptime | grep -o '^[0-9]\+')
system_up_text=$(uptime -p | cut -d ' ' -f 2- | cut -d ',' -f 1 | awk '{print $1 substr($2, 1, 1)}')
/home/admin/_cache.sh set system_up "${system_up}"
/home/admin/_cache.sh set system_up_text "${system_up_text}"
# cpu load
cpu_load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2)
@ -171,9 +159,7 @@ do
fi
# ram
ram=$(free -m | grep Mem | awk '{ print $2 }')
ram_avail=$(free -m | grep Mem | awk '{ print $7 }')
/home/admin/_cache.sh set system_ram_mb "${ram}"
ram_avail=$(free -m | grep -E 'Mem|Speicher' | awk '{ print $7 }')
/home/admin/_cache.sh set system_ram_available_mb "${ram_avail}"
# undervoltage

View File

@ -717,6 +717,7 @@ do
if [ ${recheckRAID} -eq 1 ]; then
# check if BTRTFS raid is active & scrub
logger -p info "background.sh - RAID data check"
source <(/home/admin/config.scripts/blitz.datadrive.sh status)
if [ "${isBTRFS}" == "1" ] && [ "${isRaid}" == "1" ]; then
echo "STARTING BTRFS RAID DATA CHECK ..."

View File

@ -337,6 +337,34 @@ else
echo "No HDMI switch found. " >> $logFile
fi
################################
# GPT integrity check
################################
check_and_fix_gpt() {
local device=$1
output=$(sudo gdisk -l $device 2>&1)
if echo "$output" | grep -q "PMBR size mismatch"; then
echo "GPT PMBR size mismatch detected on $device. Fixing..." >> $logFile
sgdisk -e $device
echo "Fixed GPT PMBR size mismatch on $device." >> $logFile
elif echo "$output" | grep -q "The backup GPT table is not on the end of the device"; then
echo "Backup GPT table is not at the end of $device. Fixing..." >> $logFile
sgdisk -e $device
echo "Fixed backup GPT table location on $device." >> $logFile
else
echo "No GPT issues detected on $device." >> $logFile
fi
}
# List all block devices
devices=$(lsblk -dno NAME | grep -E '^sd|^nvme|^vd|^mmcblk')
# Check and fix each device
for dev in $devices; do
check_and_fix_gpt /dev/$dev
done
################################
# FS EXPAND
# extend sd card to maximum capacity
@ -520,13 +548,15 @@ if [ "${baseimage}" == "raspios_arm64" ]; then
isRaspberryPi5=$(cat /proc/device-tree/model 2>/dev/null | grep -c "Raspberry Pi 5")
firmwareBuildNumber=$(rpi-eeprom-update | grep "CURRENT" | cut -d "(" -f2 | sed 's/[^0-9]*//g')
echo "checking Firmware: isRaspberryPi5(${isRaspberryPi5}) firmwareBuildNumber(${firmwareBuildNumber})" >> $logFile
if [ ${isRaspberryPi5} -gt 0 ] && [ ${firmwareBuildNumber} -lt 1701887365 ]; then
echo "RaspberryPi 5 detected with old firmware ... do update." >> $logFile
if [ ${isRaspberryPi5} -gt 0 ] && [ ${firmwareBuildNumber} -lt 1708097321 ]; then # Fri 16 Feb 15:28:41 UTC 2024 (1708097321)
echo "updating Firmware" >> $logFile
echo "RaspberryPi 5 detected with old firmware (${firmwareBuildNumber}) ... do update." >> $logFile
apt-get update -y
apt-get upgrade -y
apt-get install -y rpi-eeprom
rpi-eeprom-update -a
echo "Restarting ..." >> $logFile
sleep 3
reboot
else
echo "RaspberryPi Firmware not in th need of update." >> $logFile
@ -989,7 +1019,6 @@ if [ ${isMounted} -eq 0 ]; then
# system has to wait before reboot to present like seed words and other info/options to user
echo "BOOTSTRAP EXIT ... waiting for final setup controller to initiate final reboot." >> $logFile
echo "------------> You may login thru web browser to continue setup." >> $logFile
exit 1
else

View File

@ -55,6 +55,11 @@ function blitzhelp() {
echo " cache check on chache system state"
echo " github jumping directly into the options to change branch/repo/pr"
echo
echo "Development with VM:"
echo " sync sync all repos from shared folder"
echo " sync code sync only main raspiblitz repo from shared folder"
echo " sync api sync only blitz api repo from shared folder"
echo
echo "Power:"
echo " restart restart the node"
echo " off shutdown the node"
@ -81,7 +86,7 @@ function blitzhelp() {
echo " whitepaper download the whitepaper from the blockchain to /home/admin/bitcoin.pdf"
echo " notifyme wrapper for blitz.notify.sh that will send a notification using the configured method and settings"
echo " suez visualize channels (for the default ln implementation and chain when installed)"
exho " lnproxy wrap invoices with lnproxy"
echo " lnproxy wrap invoices with lnproxy"
echo
echo "LND:"
echo " lncli LND commandline interface (when installed)"
@ -215,6 +220,13 @@ function patch() {
echo
}
# command: sync
# sync VM with shared folder
function sync() {
sudo /home/admin/config.scripts/blitz.vm.sh sync ${1}
echo
}
# command: off
function off() {
echo "Command to power off your RaspiBlitz"
@ -345,8 +357,8 @@ function bos() {
# switch to the pyblock user for PyBLOCK
function pyblock() {
if [ $(grep -c "pyblock=on" < /mnt/hdd/raspiblitz.conf) -eq 1 ]; then
cd /home/pyblock
sudo -u pyblock /home/pyblock/.local/bin/pyblock
cd /home/pyblock/pyblock
sudo -u pyblock poetry run python -m pybitblock.console
else
echo "PyBlock is not installed - to install run:"
echo "/home/admin/config.scripts/bonus.pyblock.sh on"

View File

@ -183,13 +183,6 @@ if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
# prepare lnd service
cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service >> ${logFile} 2>&1
# convert old keysend by lndExtraParameter to raspiblitz.conf setting (will be enforced by lnd.check.sh prestart) since 1.7.1
if [ "${lndExtraParameter}" == "--accept-keysend" ]; then
echo "# MIGRATION KEYSEND from lndExtraParameter --> raspiblitz.conf" >> ${logFile}
/home/admin/config.scripts/blitz.conf.sh set lndKeysend "on"
/home/admin/config.scripts/blitz.conf.sh delete lndExtraParameter
fi
# if old lnd.conf exists ...
configExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then

View File

@ -61,6 +61,9 @@ echo "deprecatedrpc=addresses" >> /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null
# backup SSH PubKeys
/home/admin/config.scripts/blitz.ssh.sh backup
# set timezone
/home/admin/config.scripts/blitz.time.sh set-by-config >> ${logFile}
# optimize mempool if RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
@ -219,7 +222,7 @@ echo "### RUNNING PROVISIONING SERVICES ###" >> ${logFile}
# BITCOIN INTERIMS UPDATE
if [ ${#bitcoinInterimsUpdate} -gt 0 ]; then
/home/admin/_cache.sh set message "Provisioning Bitcoin Core update"
/home/admin/_cache.sh set message "Bitcoin Core update"
if [ "${bitcoinInterimsUpdate}" == "reckless" ]; then
# recklessly update Bitcoin Core to latest release on GitHub
echo "Provisioning Bitcoin Core reckless interims update" >> ${logFile}
@ -363,15 +366,6 @@ else
echo "Provisioning Tor - keep default" >> ${logFile}
fi
# AUTO PILOT
if [ "${autoPilot}" = "on" ]; then
echo "Provisioning AUTO PILOT - run config script" >> ${logFile}
/home/admin/_cache.sh set message "Setup AutoPilot"
/home/admin/config.scripts/lnd.autopilot.sh on >> ${logFile} 2>&1
else
echo "Provisioning AUTO PILOT - keep default" >> ${logFile}
fi
# NETWORK UPNP
if [ "${networkUPnP}" = "on" ]; then
echo "Provisioning NETWORK UPnP - run config script" >> ${logFile}
@ -473,16 +467,6 @@ else
echo "Provisioning BTCPayServer - keep default" >> ${logFile}
fi
# deprecated - see: #2031
# LNDMANAGE
#if [ "${lndmanage}" = "on" ]; then
# echo "Provisioning lndmanage - run config script" >> ${logFile}
# /home/admin/_cache.sh set message "Setup lndmanage"
# sudo -u admin /home/admin/config.scripts/bonus.lndmanage.sh on >> ${logFile} 2>&1
#else
# echo "Provisioning lndmanage - not active" >> ${logFile}
#fi
# CUSTOM PORT
echo "Provisioning LND Port" >> ${logFile}
if [ ${#lndPort} -eq 0 ]; then
@ -547,14 +531,14 @@ else
echo "Provisioning LCD rotate - not needed, keep default rotate on" >> ${logFile}
fi
# TOUCHSCREEN
if [ "${#touchscreen}" -gt 0 ]; then
echo "Provisioning Touchscreen - run config script" >> ${logFile}
/home/admin/_cache.sh set message "Setup Touchscreen"
/home/admin/config.scripts/blitz.touchscreen.sh ${touchscreen} >> ${logFile} 2>&1
else
echo "Provisioning Touchscreen - not active" >> ${logFile}
fi
# TOUCHSCREEN - deactivated see https://github.com/raspiblitz/raspiblitz/pull/4609#issuecomment-2144406124
# if [ "${#touchscreen}" -gt 0 ]; then
# echo "Provisioning Touchscreen - run config script" >> ${logFile}
# /home/admin/_cache.sh set message "Setup Touchscreen"
# /home/admin/config.scripts/blitz.touchscreen.sh ${touchscreen} >> ${logFile} 2>&1
# else
# echo "Provisioning Touchscreen - not active" >> ${logFile}
# fi
# UPS
if [ "${#ups}" -gt 0 ]; then
@ -613,15 +597,6 @@ else
echo "Provisioning Balance of Satoshis - keep default" >> ${logFile}
fi
## LNPROXY
#if [ "${lnproxy}" = "on" ]; then
# echo "Provisioning lnproxy - run config script" >> ${logFile}
# /home/admin/_cache.sh set message "Setup lnproxy"
# sudo -u admin /home/admin/config.scripts/bonus.lnproxy.sh on >> ${logFile} 2>&1
#else
# echo "Provisioning lnproxy - keep default" >> ${logFile}
#fi
# thunderhub
if [ "${thunderhub}" = "on" ]; then
echo "Provisioning ThunderHub - run config script" >> ${logFile}
@ -685,6 +660,15 @@ else
echo "Provisioning LIT - keep default" >> ${logFile}
fi
# labelbase
if [ "${labelbase}" = "on" ]; then
echo "Provisioning Labelbase - run config script" >> ${logFile}
/home/admin/_cache.sh set message "Setup Labelbase"
sudo -u admin /home/admin/config.scripts/bonus.labelbase.sh on >> ${logFile} 2>&1
else
echo "Provisioning Labelbase - keep default" >> ${logFile}
fi
# lndg
if [ "${lndg}" = "on" ]; then
echo "Provisioning LNDg - run config script" >> ${logFile}
@ -694,15 +678,6 @@ else
echo "Provisioning LNDg - keep default" >> ${logFile}
fi
# sphinxrelay
if [ "${sphinxrelay}" = "on" ]; then
echo "Sphinx-Relay - run config script" >> ${logFile}
/home/admin/_cache.sh set message "Setup Sphinx-Relay"
sudo -u admin /home/admin/config.scripts/bonus.sphinxrelay.sh on >> ${logFile} 2>&1
else
echo "Sphinx-Relay - keep default" >> ${logFile}
fi
# helipad
if [ "${helipad}" = "on" ]; then
echo "Helipad - run config script" >> ${logFile}
@ -721,15 +696,6 @@ else
echo "Provisioning CircuitBreaker - keep default" >> ${logFile}
fi
# tallycoin_connect
if [ "${tallycoinConnect}" = "on" ]; then
echo "Provisioning Tallycoin Connect - run config script" >> ${logFile}
/home/admin/_cache.sh set message "Setup Tallycoin Connect"
sudo -u admin /home/admin/config.scripts/bonus.tallycoin-connect.sh on >> ${logFile} 2>&1
else
echo "Provisioning Tallycoin Connect - keep default" >> ${logFile}
fi
# squeaknode
if [ "${squeaknode}" = "on" ]; then
echo "Provisioning Squeaknode - run config script" >> ${logFile}
@ -807,6 +773,10 @@ echo "Start i2pd" >> ${logFile}
/home/admin/_cache.sh set message "i2pd setup"
/home/admin/config.scripts/blitz.i2pd.sh on >> ${logFile}
# clean up raspiblitz config from old settings
sed -i '/^autoPilot=/d' /mnt/hdd/raspiblitz.conf
sed -i '/^lndKeysend=/d' /mnt/hdd/raspiblitz.conf
# signal setup done
/home/admin/_cache.sh set message "Setup Done"

View File

@ -1,3 +1,3 @@
# RaspiBlitz Version - always [major].[main].[sub] (sub can be a string like '2rc1')
codeVersion="1.11.0"
codeVersion="1.11.1"
# keep last line with comment ---> IF YOU HAVE A NEW VERSION BRANCH > EDIT ALSO build_sdcard.sh

View File

@ -19,6 +19,11 @@ server {
location / {
proxy_pass http://127.0.0.1:5000;
# needed for websocket connections
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
include /etc/nginx/snippets/ssl-proxy-params.conf;
}

View File

@ -19,6 +19,11 @@ server {
location / {
proxy_pass https://127.0.0.1:5001;
# needed for websocket connections
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
include /etc/nginx/snippets/ssl-proxy-params.conf;
}

View File

@ -1,21 +0,0 @@
## tallycoin_connect_ssl.conf
server {
listen 8124 ssl http2;
listen [::]:8124 ssl http2;
server_name _;
include /etc/nginx/snippets/ssl-params.conf;
include /etc/nginx/snippets/ssl-certificate-app-data.conf;
include /etc/nginx/snippets/gzip-params.conf;
access_log /var/log/nginx/access_tallycoin_connect.log;
error_log /var/log/nginx/error_tallycoin_connect.log;
location / {
proxy_pass http://127.0.0.1:8123;
include /etc/nginx/snippets/ssl-proxy-params.conf;
}
}

View File

@ -1,18 +0,0 @@
## tallycoin_connect_tor.conf
server {
listen 8125;
listen [::]:8125;
server_name _;
include /etc/nginx/snippets/gzip-params.conf;
access_log /var/log/nginx/access_tallycoin_connect.log;
error_log /var/log/nginx/error_tallycoin_connect.log;
location / {
proxy_pass http://127.0.0.1:8123;
include /etc/nginx/snippets/ssl-proxy-params.conf;
}
}

View File

@ -1,21 +0,0 @@
## tallycoin_connect_tor_ssl.conf
server {
listen 8126 ssl http2;
listen [::]:8126 ssl http2;
server_name _;
include /etc/nginx/snippets/ssl-params.conf;
include /etc/nginx/snippets/ssl-certificate-app-data-tor.conf;
include /etc/nginx/snippets/gzip-params.conf;
access_log /var/log/nginx/access_tallycoin_connect.log;
error_log /var/log/nginx/error_tallycoin_connect.log;
location / {
proxy_pass http://127.0.0.1:8123;
include /etc/nginx/snippets/ssl-proxy-params.conf;
}
}

View File

@ -148,7 +148,11 @@ if [ "$2" = "info" ]; then
if [ "$1" == "signet" ]; then
subfolder="signet/"
fi
btc_blocks_data_kb=$(sudo du -s /mnt/hdd/bitcoin/${subfolder}blocks | cut -f1)
btc_blocks_data_kb=$(du -s /mnt/hdd/bitcoin/${subfolder}blocks | cut -f1)
if [ "${btc_blocks_data_kb}" == "" ]; then
btc_blocks_data_kb="0"
fi
# parse data
btc_blocks_headers=$(echo "${blockchaininfo}" | jq -r '.headers')
@ -156,9 +160,14 @@ if [ "$2" = "info" ]; then
btc_blocks_behind=$((${btc_blocks_headers} - ${btc_blocks_verified}))
btc_sync_initialblockdownload=$(echo "${blockchaininfo}" | jq -r '.initialblockdownload' | grep -c 'true')
btc_sync_progress=$(echo "${blockchaininfo}" | jq -r '.verificationprogress')
if (( $(awk 'BEGIN { print( '${btc_sync_progress}'<0.99995 ) }') )); then
if [[ "${btc_sync_progress}" == *"e-"* ]]; then
# is still very small - round up to 0.01%
btc_sync_percentage="0.01"
elif (( $(awk 'BEGIN { print( '${btc_sync_progress}'<0.99995 ) }') )); then
# #3620 prevent displaying 100.00%, although incorrect because of rounding
btc_sync_percentage=$(awk 'BEGIN { printf( "%.2f%%", 100 * '${btc_sync_progress}') }')
btc_sync_percentage="${btc_sync_progress:2:2}.${btc_sync_progress:4:2}"
# remove trailing zero if present (just first one)
btc_sync_percentage="${btc_sync_percentage#0}"
elif [ "${btc_blocks_headers}" != "" ] && [ "${btc_blocks_headers}" == "${btc_blocks_verified}" ]; then
btc_sync_percentage="100.00"
else
@ -247,7 +256,7 @@ if [ "$2" = "peer-kickstart" ]; then
if [ "$(cat /mnt/hdd/raspiblitz.conf | grep -c "^runBehindTor=on")" != "0" ]; then
addressFormat="tor"
else
source <(sudo /home/admin/config.scripts/internet.sh status global)
source <(/home/admin/config.scripts/internet.sh status global)
if [ "${ipv6}" == "off" ]; then
addressFormat="ipv4"
else

View File

@ -0,0 +1,80 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# Switches on bitcoind mainnet behind the scenes to testnet."
echo "# !!! JUST USE FOR DEVELOPEMNT - NOT FOR PRODUCTION !!!"
echo "# "
echo "# bitcoin.testnet.sh [activate|revert]"
echo
exit 1
fi
# make sure user is root
if [ $UID -ne 0 ]; then
echo "error='run this script with sudo'"
exit 1
fi
echo "# Running: bitcoin.testnet.sh $*"
if [ "$1" == "activate" ]; then
# check if bitcoin testnet is already activated
testnetSet=$(cat /mnt/hdd/bitcoin/bitcoin.conf | grep -c "^testnet=1")
if [ $testnetSet -gt 0 ]; then
echo "error='testnet is already activated'"
exit 1
fi
echo "# SWITCHING TO TESTNET .."
# make changes to bitcoin.conf
sed -i 's|^testnet=0|testnet=1|' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's/^\(main.debuglogfile=.*\)/#\1/' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's|^test.debuglogfile=/mnt/hdd/bitcoin/testnet3/debug.log|test.debuglogfile=/mnt/hdd/bitcoin/debug.log|' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's/^\(main.rpcbind=.*\)/#\1/' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's|^test.rpcbind=127.0.0.1:18332|test.rpcbind=127.0.0.1:8332|' /mnt/hdd/bitcoin/bitcoin.conf
# restart bitcoind service
systemctl restart bitcoind.service
echo "# OK bitcoind should now run testnet on mainnet ports"
echo "# If you want to save space you can delete old mainnet blockchain with:"
echo "# rm -rf /mnt/hdd/bitcoin/blocks"
echo "# rm -rf /mnt/hdd/bitcoin/chainstate"
exit 0
fi
if [ "$1" == "revert" ]; then
# check if bitcoin testnet is already activated
testnetSet=$(cat /mnt/hdd/bitcoin/bitcoin.conf | grep -c "^testnet=1")
if [ $testnetSet -eq 0 ]; then
echo "error='testnet is not activated'"
exit 1
fi
echo "# SWITCHING BACK TO MAINNET .."
# make changes to bitcoin.conf
sed -i 's|^testnet=1|testnet=0|' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's|^#main.debuglogfile=.*|main.debuglogfile=/mnt/hdd/bitcoin/debug.log|' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's|^test.debuglogfile=/mnt/hdd/bitcoin/debug.log|test.debuglogfile=/mnt/hdd/bitcoin/testnet3/debug.log|' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's|^#main.rpcbind=.*|main.rpcbind=127.0.0.1:8332|' /mnt/hdd/bitcoin/bitcoin.conf
sed -i 's|^test.rpcbind=127.0.0.1:8332|test.rpcbind=127.0.0.1:18332|' /mnt/hdd/bitcoin/bitcoin.conf
# restart bitcoind service
systemctl restart bitcoind.service
echo "# OK bitcoind should now run normal mainnet again"
echo "# If you want to save space you can delete old testnet blockchain with:"
echo "# rm -rf /mnt/hdd/bitcoin/testnet3/blocks"
echo "# rm -rf /mnt/hdd/bitcoin/testnet3/chainstate"
exit 0
fi
echo "error='unkown parameter'"
exit 1

View File

@ -19,9 +19,8 @@ echo "# Running: bitcoin.update.sh $*"
# 1. parameter [info|tested|reckless]
mode="$1"
# RECOMMENDED UPDATE BY RASPIBLITZ TEAM (just possible once per sd card update)
# comment will be shown as "BEWARE Info" when option is chosen (can be multiple lines)
bitcoinVersion="" # example: 22.0 .. keep empty if no newer version as sd card build is available
# RECOMMENDED UPDATE BY RASPIBLITZ TEAM (latest tested version available)
bitcoinVersion="27.1" # example: 22.0 .. keep empty if no newer version as sd card build is available
# GATHER DATA
# setting download directory to the current user
@ -59,6 +58,39 @@ function displayInfo() {
echo "bitcoinLatestVersion='${bitcoinLatestVersion}'"
}
# COMAPRE TWO VERSION STRINGS
# 0 = first version string is equal
# 1 = first version string is older
# 2 = first version string is newer
function version_compare() {
if [[ $1 == $2 ]]
then
echo "equal"
return 0
fi
IFS='.' read -r -a ver1 <<< "$1"
IFS='.' read -r -a ver2 <<< "$2"
len1=${#ver1[@]}
len2=${#ver2[@]}
max_len=$((len1>len2?len1:len2))
for ((i=0; i<max_len; i++))
do
part1=${ver1[i]:-0}
part2=${ver2[i]:-0}
if ((part1 < part2))
then
# older
return 1
elif ((part1 > part2))
then
# newer
return 2
fi
done
# equal
return 0
}
if [ "${mode}" = "info" ]; then
displayInfo
exit 1
@ -69,20 +101,43 @@ if [ "${mode}" = "tested" ]; then
echo "# bitcoin.update.sh tested"
# check if a tested update is available
if [ ${#bitcoinVersion} -eq 0 ]; then
echo "# warn='no tested update available'"
echo "# thats OK on update from older versions"
/home/admin/config.scripts/blitz.conf.sh delete bitcoinInterimsUpdate 2>/dev/null
exit 1
fi
# check for optional second parameter: forced update version
# --> only does the tested update if its the given version
# this is needed for recovery/update.
fixedBitcoinVersion="$2"
if [ ${#fixedBitcoinVersion} -gt 0 ]; then
echo "# checking for fixed version update: askedFor(${bitcoinVersion}) available(${bitcoinVersion})"
if [ "${fixedBitcoinVersion}" != "${bitcoinVersion}" ]; then
echo "# warn='required update version does not match'"
echo "# this is normal when the recovery script of a new RaspiBlitz version checks for an old update - just ignore"
echo "# checking for fixed version update: installed(${installedVersion}) requested(${fixedBitcoinVersion}) available(${bitcoinVersion})"
version_compare "${fixedBitcoinVersion}" "${bitcoinVersion}"
result=$?
if [ "${result}" -eq 2 ]; then
echo "# WARNING: requested version is newer then available tested --> ABORT (already up2date)"
exit 1
else
echo "# OK - update version is matching"
echo "# requested version is older or equal --> OK install available tested version"
fi
fi
# check against installed version
version_compare "${installedVersion}" "${bitcoinVersion}"
result=$?
if [ "${result}" -eq 2 ]; then
# this can happen if bitcoin install script already has a higher version then the tested version set by this script (see above)
echo "# installed version is newer then to be updated version --> ABORT"
echo
exit 1
fi
if [ "${result}" -eq 0 ]; then
echo "# version is already installed --> ABORT"
echo
exit 1
fi
pathVersion=${bitcoinVersion}
elif [ "${mode}" = "reckless" ]; then

View File

@ -27,10 +27,11 @@ action=$1
#########################
# STATUS
# gather data on sd card
# gather data on SDcard / OS drive
minimumSizeByte=16384000000
rootPartition=$(sudo mount | grep " / " | cut -d " " -f 1 | cut -d "/" -f 3)
rootPartitionBytes=$(lsblk -b -o NAME,SIZE | grep "${rootPartition}" | tr -s ' ' | cut -d " " -f 2)
rootPartitionLine=$(sudo mount | grep " / " | cut -d " " -f 1)
rootPartition=$(basename ${rootPartitionLine})
rootPartitionBytes=$(lsblk -b -o NAME,SIZE | grep "${rootPartition}" | awk '{print $2}')
# make conclusions
needsExpansion=0

View File

@ -218,7 +218,7 @@ if [ "$1" = "status" ]; then
fi
# try to detect if its an SSD
isSMART=$(sudo smartctl -a /dev/${hdd} | grep -c "Serial Number:")
isSMART=$(smartctl -a /dev/${hdd} | grep -c "Serial Number:")
echo "isSMART=${isSMART}"
isSSD=1
isRotational=$(echo "${smartCtlA}" | grep -c "Rotation Rate:")
@ -458,7 +458,7 @@ if [ "$1" = "status" ]; then
fi
echo "hddRaspiVersion='${hddRaspiVersion}'"
smartCtlA=$(sudo smartctl -a /dev/${hdd} | tr -d '"')
smartCtlA=$(smartctl -a /dev/${hdd} | tr -d '"')
# try to detect if its an SSD
isSMART=$(echo "${smartCtlA}" | grep -c "Serial Number:")

View File

@ -464,7 +464,7 @@ sudo /home/admin/config.scripts/blitz.zram.sh status
echo
echo "*** HARDWARE TEST RESULTS ***"
sudo vcgencmd get_throttled
sudo vcgencmd get_throttled 2>/dev/null
source <(/home/admin/_cache.sh get system_count_undervoltage)
showImproveInfo=0
if [ ${#system_count_undervoltage} -gt 0 ]; then

View File

@ -92,10 +92,20 @@ sudo -u admin curl -H "Accept: application/json; indent=4" https://bitnodes.io/a
# Fallback Nodes List from Bitcoin Core
sudo -u admin curl https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_main.txt -o /home/admin/fallback.bitcoin.nodes
echo "* Adding Raspiblitz API ..."
sudo /home/admin/config.scripts/blitz.web.api.sh on "${defaultAPIuser}" "${defaultAPIrepo}" "blitz-${branch}" || exit 1
echo "* Adding Raspiblitz WebUI ..."
sudo /home/admin/config.scripts/blitz.web.ui.sh on "${defaultWEBUIuser}" "${defaultWEBUIrepo}" "release/${branch}" || exit 1
# use dev branch when its an Release Candidate
source <(/home/admin/_cache.sh get codeVersion)
if [[ "$codeVersion" == *"rc"* ]]; then
echo "# RELEASE CANDIDATE: using development branches for WebUI & API"
echo "* Adding Raspiblitz API ..."
sudo /home/admin/config.scripts/blitz.web.api.sh on "${defaultAPIuser}" "${defaultAPIrepo}" "dev" || exit 1
echo "* Adding Raspiblitz WebUI ..."
sudo /home/admin/config.scripts/blitz.web.ui.sh on "${defaultWEBUIuser}" "${defaultWEBUIrepo}" "master" || exit 1
else
echo "* Adding Raspiblitz API ..."
sudo /home/admin/config.scripts/blitz.web.api.sh on "${defaultAPIuser}" "${defaultAPIrepo}" "blitz-${branch}" || exit 1
echo "* Adding Raspiblitz WebUI ..."
sudo /home/admin/config.scripts/blitz.web.ui.sh on "${defaultWEBUIuser}" "${defaultWEBUIrepo}" "release/${branch}" || exit 1
fi
# set build code as new www default
sudo rm -r /home/admin/assets/nginx/www_public

View File

@ -13,11 +13,31 @@ fi
# detect known SBCs
board=""
isRaspberryPi4=$(cat /proc/device-tree/model | grep -c "Raspberry Pi 4")
# detect RaspberryPi 3
isRaspberryPi3=$(cat /proc/device-tree/model 2>/dev/null | grep -c "Raspberry Pi 3")
if [ "${isRaspberryPi3}" == "1" ]; then
board="rp3"
fi
# detect RaspberryPi 4
isRaspberryPi4=$(cat /proc/device-tree/model 2>/dev/null | grep -c "Raspberry Pi 4")
if [ "${isRaspberryPi4}" == "1" ]; then
board="rp4"
fi
# detect RaspberryPi 5
isRaspberryPi5=$(cat /proc/device-tree/model 2>/dev/null | grep -c "Raspberry Pi 5")
if [ "${isRaspberryPi5}" == "1" ]; then
board="rp5"
fi
# detect VM
isVM=$(grep -c 'hypervisor' /proc/cpuinfo)
if [ ${isVM} -gt 0 ]; then
board="vm"
fi
# get how many RAM (in MB)
ramMB=$(awk '/MemTotal/ {printf( "%d\n", $2 / 1024 )}' /proc/meminfo)

View File

@ -9,7 +9,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "blitz.i2pd.sh install -> Install i2pd"
echo "blitz.i2pd.sh on -> Switch on i2pd"
echo "blitz.i2pd.sh off -> Uninstall i2pd"
echo "blitz.i2pd.sh addseednodes -> Add all I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
echo "blitz.i2pd.sh addseednodes -> Add 21 randonly selected I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
echo "blitz.i2pd.sh status -> I2P related logs from bitcoind, bitcoin-cli -netinfo 4 and webconsole access"
exit 1
fi
@ -38,44 +38,44 @@ function add_repo {
source /etc/os-release
DIST=$ID
case $ID in
debian|ubuntu|raspbian)
if [[ -n $DEBIAN_CODENAME ]]; then
VERSION_CODENAME=$DEBIAN_CODENAME
fi
if [[ -n $UBUNTU_CODENAME ]]; then
VERSION_CODENAME=$UBUNTU_CODENAME
fi
if [[ -z $VERSION_CODENAME ]]; then
echo "Couldn't find VERSION_CODENAME in your /etc/os-release file. Did your system supported? Please report issue to me by writing to email: 'r4sas <at> i2pd.xyz'"
exit 1
fi
RELEASE=$VERSION_CODENAME
debian | ubuntu | raspbian)
if [[ -n $DEBIAN_CODENAME ]]; then
VERSION_CODENAME=$DEBIAN_CODENAME
fi
if [[ -n $UBUNTU_CODENAME ]]; then
VERSION_CODENAME=$UBUNTU_CODENAME
fi
if [[ -z $VERSION_CODENAME ]]; then
echo "Couldn't find VERSION_CODENAME in your /etc/os-release file. Did your system supported? Please report issue to me by writing to email: 'r4sas <at> i2pd.xyz'"
exit 1
fi
RELEASE=$VERSION_CODENAME
;;
*)
if [[ -z $ID_LIKE || "$ID_LIKE" != "debian" && "$ID_LIKE" != "ubuntu" ]]; then
echo "Your system is not supported by this script. Currently it supports debian-like and ubuntu-like systems."
exit 1
else
DIST=$ID_LIKE
case $ID_LIKE in
debian)
if [[ "$ID" == "kali" ]]; then
if [[ "$VERSION" == "2019"* || "$VERSION" == "2020"* ]]; then
RELEASE="buster"
elif [[ "$VERSION" == "2021"* || "$VERSION" == "2022"* ]]; then
RELEASE="bullseye"
fi
else
RELEASE=$DEBIAN_CODENAME
fi
;;
ubuntu)
RELEASE=$UBUNTU_CODENAME
;;
esac
fi
;;
esac
*)
if [[ -z $ID_LIKE || "$ID_LIKE" != "debian" && "$ID_LIKE" != "ubuntu" ]]; then
echo "Your system is not supported by this script. Currently it supports debian-like and ubuntu-like systems."
exit 1
else
DIST=$ID_LIKE
case $ID_LIKE in
debian)
if [[ "$ID" == "kali" ]]; then
if [[ "$VERSION" == "2019"* || "$VERSION" == "2020"* ]]; then
RELEASE="buster"
elif [[ "$VERSION" == "2021"* || "$VERSION" == "2022"* ]]; then
RELEASE="bullseye"
fi
else
RELEASE=$DEBIAN_CODENAME
fi
;;
ubuntu)
RELEASE=$UBUNTU_CODENAME
;;
esac
fi
;;
esac
if [[ -z $RELEASE ]]; then
echo "Couldn't detect your system release. Please report issue to me by writing to email: 'r4sas <at> i2pd.xyz'"
exit 1
@ -111,7 +111,7 @@ echo "# Running: 'blitz.i2pd.sh $*'"
source /mnt/hdd/raspiblitz.conf
# make sure to be present in PATH
if ! echo "$PATH" | grep "/usr/sbin"; then
if ! echo "$PATH" | grep "/usr/sbin" >/dev/null; then
export PATH=$PATH:/usr/sbin
echo "PATH=\$PATH:/usr/sbin" | sudo tee -a /etc/profile
fi
@ -222,20 +222,30 @@ fi
if [ "$1" = "addseednodes" ]; then
/home/admin/config.scripts/blitz.i2pd.sh on
if ! sudo -u bitcoin bitcoin-cli -netinfo 4 | grep i2p; then
/home/admin/config.scripts/blitz.i2pd.sh on
fi
echo "Add 21 randomly selected I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
echo "Monitor in a new terminal with:"
echo "watch sudo -u bitcoin bitcoin-cli -netinfo 4"
echo "This will take some time ..."
echo "Add all I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
# Fetch and filter the list of seed nodes
i2pSeedNodeList=$(curl -sS https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_main.txt | grep .b32.i2p:0)
for i2pSeedNode in ${i2pSeedNodeList}; do
bitcoin-cli addnode "$i2pSeedNode" "onetry"
done
echo
echo "# Display sudo tail -n 100 /mnt/hdd/bitcoin/debug.log | grep i2p"
sudo tail -n 100 /mnt/hdd/bitcoin/debug.log | grep i2p
# Shuffle the list and pick the first 21 nodes
selectedNodes=$(echo "$i2pSeedNodeList" | shuf | head -n 21)
# Add each selected node
for i2pSeedNode in ${selectedNodes}; do
echo "# Add i2p seed node: ${i2pSeedNode} by running:"
echo "bitcoin-cli addnode $i2pSeedNode onetry"
sudo -u bitcoin bitcoin-cli addnode "$i2pSeedNode" "onetry"
done
echo
echo "# Display bitcoin-cli -netinfo 4"
bitcoin-cli -netinfo 4
sudo -u bitcoin bitcoin-cli -netinfo 4
exit 0
fi

View File

@ -338,27 +338,31 @@ elif [ "${abcd}" = "b" ]; then
sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /mnt/hdd/${network}/${network}.conf 2>/dev/null
sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /home/admin/.${network}/${network}.conf 2>/dev/null
# NOTE: now other bonus apps configs that need passwordB need to be adapted manually
# bonus apps that use a "prestart" will adapt themselves on service restart after reboot
# dont reboot - starting either services manually below or they get restarted thru
# systemd dependencies like on bitcoind (Partof=...) after all configs changed
reboot=0;
# blitzweb
if ! [ -f /etc/nginx/.htpasswd ]; then
echo "${newPassword}" | sudo htpasswd -ci /etc/nginx/.htpasswd admin
else
echo "${newPassword}" | sudo htpasswd -i /etc/nginx/.htpasswd admin
fi
echo "# restart bitcoind"
sudo systemctl restart ${network}d
# NOTE: now other bonus apps configs that need passwordB need to be adapted manually
# bonus apps that use a "prestart" will adapt themselves on service
# electrs
if [ "${ElectRS}" == "on" ]; then
echo "# changing the RPC password for ELECTRS"
RPC_USER=$(cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-)
sudo sed -i "s/^auth = \"$RPC_USER.*\"/auth = \"$RPC_USER:${newPassword}\"/g" /home/electrs/.electrs/config.toml
echo "# restarting electrs"
sudo systemctl restart electrs.service
fi
# BTCPayServer
if [ "${BTCPayServer}" == "on" ]; then
echo "# changing the RPC password for BTCPAYSERVER"
sudo sed -i "s/^btc.rpc.password=.*/btc.rpc.password=${newPassword}/g" /home/btcpay/.nbxplorer/Main/settings.config
echo "# restarting btcpay server"
sudo systemctl restart btcpayserver.service
fi
# JoinMarket
@ -367,12 +371,16 @@ elif [ "${abcd}" = "b" ]; then
sudo sed -i "s/^rpc_password =.*/rpc_password = ${newPassword}/g" /home/joinmarket/.joinmarket/joinmarket.cfg
echo "# changing the password for the 'joinmarket' user"
echo "joinmarket:${newPassword}" | sudo chpasswd
echo "# restarting jopinmarket API"
sudo systemctl restart joinmarket-api.service
fi
# ThunderHub
if [ "${thunderhub}" == "on" ]; then
echo "# changing the password for ThunderHub"
sudo sed -i "s/^masterPassword:.*/masterPassword: '${newPassword}'/g" /mnt/hdd/app-data/thunderhub/thubConfig.yaml
echo "# restarting thunderhub.service"
sudo systemctl restart thunderhub.service
fi
# LIT
@ -380,18 +388,26 @@ elif [ "${abcd}" = "b" ]; then
echo "# changing the password for LIT"
sudo sed -i "s/^uipassword=.*/uipassword=${newPassword}/g" /mnt/hdd/app-data/.lit/lit.conf
sudo sed -i "s/^faraday.bitcoin.password=.*/faraday.bitcoin.password=${newPassword}/g" /mnt/hdd/app-data/.lit/lit.conf
echo "# restarting litd.service"
sudo systemctl restart litd.service
fi
# i2pd
if [ "${i2pd}" == "on" ]; then
echo "# changing the password for i2pd"
sudo sed -i "s/^pass = .*/pass = ${newPassword}/g" /etc/i2pd/i2pd.conf
echo "# restarting i2pd.service"
sudo systemctl restart i2pd.service
fi
# LNDg
if [ "${lndg}" == "on" ]; then
echo "# changing the password for lndg"
/home/admin/config.scripts/bonus.lndg.sh set-password "${newPassword}"
echo "# restarting lndg services"
sudo systemctl restart jobs-lndg.service
sudo systemctl restart rebalancer-lndg.service
sudo systemctl restart htlc-stream-lndg.service
fi
# mempool Explorer
@ -400,11 +416,20 @@ elif [ "${abcd}" = "b" ]; then
sudo jq ".CORE_RPC.PASSWORD=\"${newPassword}\"" /home/mempool/mempool/backend/mempool-config.json > /var/cache/raspiblitz/mempool-config.json
sudo mv /var/cache/raspiblitz/mempool-config.json /home/mempool/mempool/backend/mempool-config.json
sudo chown mempool:mempool /home/mempool/mempool/backend/mempool-config.json
echo "# restarting mempool.service"
sudo systemctl restart mempool.service
fi
# elements
if [ "${elements}" == "on" ]; then
echo "# changing the password for elements"
sudo sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /home/elements/.elements/elements.conf
sudo sed -i "s/^mainchainrpcpassword=.*/mainchainrpcpassword=${newPassword}/g" /home/elements/.elements/elements.conf
echo "# restarting elementsd.service"
sudo systemctl restart elementsd.service
fi
echo "# OK -> RPC Password B changed"
echo "# Reboot is needed (will be triggered if interactive menu was called)"
echo "error=''"
sleep 3
############################

View File

@ -38,12 +38,6 @@ echo "cpu=${cpu}" >> /home/admin/raspiblitz.info
echo "blitzapi=${blitzapi}" >> /home/admin/raspiblitz.info
echo "displayClass=${displayClass}" >> /home/admin/raspiblitz.info
# make sure that every install runs API with own secret=
echo
echo "deleting old API conf ..."
sudo rm /home/blitzapi/blitz_api/.env 2>/dev/null
echo "OK"
# https://github.com/rootzoll/raspiblitz/issues/1371
echo
echo "deactivate local WIFI ..."
@ -53,7 +47,8 @@ echo "OK"
# make sure that every install runs API with own secret
# https://github.com/raspiblitz/raspiblitz/issues/4469
echo
# check if redis is enabled
echo "deleting old API conf ..."
sudo rm /home/blitzapi/blitz_api/.env 2>/dev/null
REDIS_ENABLED=$(sudo systemctl is-enabled redis 2>/dev/null | grep -c enabled)
if [ ${REDIS_ENABLED} -gt 0 ]; then
echo "disable redis for initial start ..."
@ -70,6 +65,14 @@ echo "reset DNS confs ..."
echo -e "nameserver 1.1.1.1\nnameserver 84.200.69.80" | sudo tee /etc/resolv.conf > /dev/null
echo "OK"
# update system (only security updates with minimal risk of breaking changes)
echo
echo "update OS ..."
sudo apt-get update -y
sudo apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/sources.list.d/security.list -y
sudo apt-get upgrade openssh-server -y
sudo dpkg --configure -a
# SSH Pubkeys (make unique for every sd card image install)
echo
echo "deleting SSH Pub keys ..."

View File

@ -622,9 +622,9 @@ def menuMakeSubscription(blitzServiceName, torAddress, torPort):
if lastusedShop == choice_url_ip2torcom: lastusedShop=""
# FULMO Shop
choice_url_fulmo="fulmo7x6yvgz6zs2b2ptduvzwevxmizhq23klkenslt5drxx2physlqd.onion"
choices.append(("B", "Fulmo Shop"))
if lastusedShop == choice_url_fulmo: lastusedShop=""
#choice_url_fulmo="fulmo7x6yvgz6zs2b2ptduvzwevxmizhq23klkenslt5drxx2physlqd.onion"
#choices.append(("B", "Fulmo Shop"))
#if lastusedShop == choice_url_fulmo: lastusedShop=""
# add before option if different from static options
if len(lastusedShop) > 0: choices.append(("Y", lastusedShop))
@ -632,30 +632,42 @@ def menuMakeSubscription(blitzServiceName, torAddress, torPort):
# enter own shop address option
choices.append(("X", "Enter a new Shop URL"))
# select dialog
# show a dialog info box
d = Dialog(dialog="dialog", autowidgetsize=True)
d.set_background_title("IP2TOR - Select Shop")
code, selected = d.menu(
"\nChoose your IP2Tor provider/shop:",
choices=choices, width=75, height=10, title="Select IP2Tor Shop")
d.msgbox('''
At the moment there are no public IP2TOR services to link to.
You could run one yourself - please check the GitHub repo:
https://github.com/raulcano/docker-ip2tor-shop''', height=10, width=72)
# select dialog
#d = Dialog(dialog="dialog", autowidgetsize=True)
#d.set_background_title("IP2TOR - Select Shop")
#code, selected = d.menu(
# "\nChoose your IP2Tor provider/shop:",
# choices=choices, width=75, height=10, title="Select IP2Tor Shop")
# if user canceled
if code != d.OK:
sys.exit(0)
#if code != d.OK:
# sys.exit(0)
if selected == "A" : shopurl=choice_url_ip2torcom
if selected == "B" : shopurl=choice_url_fulmo
if selected == "Y" : shopurl=lastusedShop
#if selected == "A" : shopurl=choice_url_ip2torcom
#if selected == "B" : shopurl=choice_url_fulmo
#if selected == "Y" : shopurl=lastusedShop
# input shop url
if selected == "X":
d = Dialog(dialog="dialog", autowidgetsize=True)
d.set_background_title("IP2TOR - Add new Shop")
code, shopurl = d.inputbox(
"Enter Address of the IP2TOR Shop (OR JUST PRESS OK):",
height=10, width=72, init=shopurl,
title="Shop Address")
if shopurl.find("://") > 0: shopurl = shopurl[shopurl.find("://") + 3:]
#if selected == "X":
d = Dialog(dialog="dialog", autowidgetsize=True)
d.set_background_title("IP2TOR - Add new Shop")
code, shopurl = d.inputbox(
"Enter Address of the IP2TOR Shop (OR JUST PRESS OK):",
height=10, width=72, init=shopurl,
title="Shop Address")
if shopurl.find("://") > 0: shopurl = shopurl[shopurl.find("://") + 3:]
# if user choose cancel
if code != d.OK:
sys.exit(0)
# try & get host list from shop
os.system('clear')

View File

@ -334,8 +334,10 @@ def subscriptions_cancel(s_id):
print(json.dumps(subs, indent=2))
# todo: deinstall letsencrypt if this was last subscription
# deinstall letsencrypt/dyndns if this was last subscription
if len(subs['subscriptions_letsencrypt']) == 0:
os.system("/home/admin/config.scripts/bonus.letsencrypt.sh off")
os.system("/home/admin/config.scripts/internet.dyndomain.sh off")
def get_subscription(subscription_id):
try:

View File

@ -20,7 +20,6 @@ SERVICE_LND_REST_API = "LND-REST-API"
SERVICE_LND_GRPC_API = "LND-GRPC-API"
SERVICE_LNBITS = "LNBITS"
SERVICE_BTCPAY = "BTCPAY"
SERVICE_SPHINX = "SPHINX"
# load config
cfg = RaspiBlitzConfig()
@ -209,11 +208,6 @@ The following additional information is available:
print("# FAIL: unknown subscription type")
time.sleep(3)
# trigger restart of relevant services so they can pickup new environment
print("# restarting services to pickup new public url (please wait) ...")
os.system("sudo systemctl restart sphinxrelay 2>/dev/null")
time.sleep(8)
# loop until no more subscriptions or user chooses CANCEL on subscription list
my_subscriptions()
@ -268,8 +262,8 @@ def main():
cfg.reload()
if not cfg.run_behind_tor.value:
Dialog(dialog="dialog", autowidgetsize=True).msgbox('''
The IP2TOR service just makes sense if you run
your RaspiBlitz behind TOR.
The IP2TOR service just makes sense if you
run your RaspiBlitz behind TOR.
''', title="Info")
sys.exit(0)
@ -281,7 +275,6 @@ def main():
lnd_grpc_api = False
lnbits = False
btcpay = False
sphinx = False
try:
if os.path.isfile(SUBSCRIPTIONS_FILE):
os.system("sudo chown admin:admin {0}".format(SUBSCRIPTIONS_FILE))
@ -297,8 +290,6 @@ def main():
lnbits = True
if sub['active'] and sub['name'] == SERVICE_BTCPAY:
btcpay = True
if sub['active'] and sub['name'] == SERVICE_SPHINX:
sphinx = True
except Exception as e:
print(e)
@ -309,17 +300,6 @@ def main():
if status_data.find("installed=1") > -1:
btc_pay_server = True
# check if Sphinx-Relay is installed
sphinx_relay = False
try:
status_data = subprocess.run(['/home/admin/config.scripts/bonus.sphinxrelay.sh', 'status'],
stdout=subprocess.PIPE, timeout=10).stdout.decode('utf-8').strip()
except Exception as e:
print(e)
if status_data.find("installed=1") > -1:
sphinx_relay = True
# ask user for which RaspiBlitz service the bridge should be used
choices = list()
choices.append(("REST", "LND REST API {0}".format("--> ALREADY BRIDGED" if lnd_rest_api else "")))
@ -328,8 +308,6 @@ def main():
choices.append(("LNBITS", "LNbits Webinterface {0}".format("--> ALREADY BRIDGED" if lnbits else "")))
if btc_pay_server:
choices.append(("BTCPAY", "BTCPay Server Webinterface {0}".format("--> ALREADY BRIDGED" if btcpay else "")))
if sphinx_relay:
choices.append(("SPHINX", "Sphinx Relay {0}".format("--> ALREADY BRIDGED" if sphinx else "")))
choices.append(("SELF", "Create a custom IP2TOR Bridge"))
d = Dialog(dialog="dialog", autowidgetsize=True)
@ -369,12 +347,6 @@ def main():
tor_address = subprocess.run(['sudo', 'cat', '/mnt/hdd/tor/btcpay/hostname'],
stdout=subprocess.PIPE).stdout.decode('utf-8').strip()
tor_port = 443
if tag == "SPHINX":
# get TOR address for SPHINX
service_name = SERVICE_SPHINX
tor_address = subprocess.run(['sudo', 'cat', '/mnt/hdd/tor/sphinxrelay/hostname'],
stdout=subprocess.PIPE).stdout.decode('utf-8').strip()
tor_port = 443
if tag == "SELF":
service_name = "CUSTOM"
try:
@ -418,12 +390,6 @@ def main():
print("# running: {0}".format(cmd))
os.system(cmd)
# action after possibly new created bride
if service_name == SERVICE_SPHINX:
print("# restarting services to pickup new public URL (please wait) ...")
os.system("sudo systemctl restart sphinxrelay")
time.sleep(8)
sys.exit(0)
if __name__ == '__main__':

View File

@ -0,0 +1,76 @@
#!/usr/bin/env bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ]; then
echo "RaspiBlitz Time Tools"
echo
echo "## Parameters #######"
echo "choose-timezone --> user can choose timezone from list and it gets stored to raspiblitz config"
echo "set-by-config --> resets the time on the RaspiBlitz based on the config"
exit 1
fi
# check if started with sudo
if [ "$EUID" -ne 0 ]; then
echo "error='missing sudo'"
exit 1
fi
###################
# choose-timezone
###################
if [ "$1" = "choose-timezone" ]; then
# Prepare the list of timezones for dialog
echo "# preparing timezone list ..."
timezones=$(timedatectl list-timezones)
timezone_list=()
i=1
for tz in $timezones; do
prefix=$(echo $tz | cut -c1)
timezone_list+=("${prefix}${i}" "$tz")
i=$((i+1))
done
# Use dialog to display the list and get the user selection
choice=$(dialog --clear \
--backtitle "Timezone Selector" \
--title "Select a Timezone" \
--menu "Choose a timezone:" 20 60 15 \
"${timezone_list[@]}" 2>&1 >/dev/tty)
# Clear the screen
clear
# Set the chosen timezone
if [ -n "$choice" ]; then
index=$(echo "$choice" | sed 's/^[A-Z]//')
selected_timezone=${timezone_list[((index * 2) - 1)]}
echo "# Setting timezone to $selected_timezone ..."
timedatectl set-timezone "$selected_timezone"
echo "# Saving timezone to raspiblitz config ..."
/home/admin/config.scripts/blitz.conf.sh set "timezone" "$selected_timezone"
else
echo "# No timezone selected"
fi
sleep 2
exit 0
fi
###################
# set-by-config
###################
if [ "$1" = "set-by-config" ]; then
source /mnt/hdd/raspiblitz.conf
if [ ${#timezone} -eq 0 ]; then
echo "# no timezone set in raspiblitz.conf ... keeping default timezone"
exit 1
fi
echo "# Setting timezone to $timezone ..."
timedatectl set-timezone "$timezone"
exit 0
fi
echo "error='unknown parameter'"
exit 1

View File

@ -0,0 +1,162 @@
#!/bin/bash
# This is for developing on your RaspiBlitz VM
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ]; then
echo "FOR DEVELOPMENT USE ONLY!"
echo "RaspiBlitzVM Sync with repos in /mnt/vm_shared_folder"
echo "blitz.vm.sh sync -> syncs all available repos in shared folder"
echo "blitz.vm.sh sync code -> syncs only the raspiblitz repo"
echo "blitz.vm.sh sync api -> syncs only the raspiblitz API repo"
echo ""
exit 1
fi
# check runnig as sudo
if [ "$EUID" -ne 0 ]; then
echo "error='please run as root'"
exit 1
fi
# check if running in vm
isVM=$(grep -c 'hypervisor' /proc/cpuinfo)
if [ ${isVM} -eq 0 ]; then
echo "# This script is only for RaspiBlitz running in a VM"
echo "error='not a VM'"
exit 1
fi
# check if shared folder exists
if [ ! -d "/mnt/vm_shared_folder" ]; then
echo "# Creating shared folder /mnt/vm_shared_folder"
mkdir /mnt/vm_shared_folder
chmod 777 /mnt/vm_shared_folder
fi
# check if shared folder is mounted
isMounted=$(mount | grep '/mnt/vm_shared_folder')
if [ ${#isMounted} -eq 0 ]; then
echo "# Mounting shared folder /mnt/vm_shared_folder"
mount -t 9p -o trans=virtio share /mnt/vm_shared_folder
if [ $? -eq 0 ]; then
echo "# OK - shared folder mounted"
else
echo "# make sure to activate shared folder in VM settings (VirtFS)"
echo "error='mount failed'"
exit 1
fi
fi
# RASPIBLITZ MAIN REPO
if [ "$2" == "code" ] || [ "$2" == "" ]; then
echo
echo "# ##### RASPIBLITZ REPO"
#check if contains a raspiblitz MAIN repo
containsRaspiBlitzRepo=$(ls /mnt/vm_shared_folder | grep -wc 'raspiblitz')
if [ ${containsRaspiBlitzRepo} -eq 0 ]; then
echo "# /mnt/vm_shared_folder does not contain a raspiblitz repo"
echo "# make sure to share the directory that contains the raspiblitz repo - not the repo itself"
echo "# make sure its named 'raspiblitz' and not 'raspiblitz-main' or 'raspiblitz-v1.7'"
if [ "$2" != "" ]; then
echo "error='no raspiblitz main repo'"
exit 1
fi
else
cd /home/admin
echo "# COPYING from VM SHARED FOLDER to /home/admin/"
echo "# - basic admin files"
rm -f *.sh
su - admin -c 'cp /mnt/vm_shared_folder/raspiblitz/home.admin/.tmux.conf /home/admin'
su - admin -c 'cp /mnt/vm_shared_folder/raspiblitz/home.admin/*.* /home/admin 2>/dev/null'
su - admin -c 'chmod 755 *.sh'
echo "# - asset directory"
rm -rf assets
su - admin -c 'cp -R /mnt/vm_shared_folder/raspiblitz/home.admin/assets /home/admin/assets'
echo "# - config.scripts directory"
rm -rf /home/admin/config.scripts
su - admin -c 'cp -R /mnt/vm_shared_folder/raspiblitz/home.admin/config.scripts /home/admin/config.scripts'
su - admin -c 'chmod 755 /home/admin/config.scripts/*.sh'
su - admin -c 'chmod 755 /home/admin/config.scripts/*.py'
echo "# - setup.scripts directory"
rm -rf /home/admin/setup.scripts
su - admin -c 'cp -R /mnt/vm_shared_folder/raspiblitz/home.admin/setup.scripts /home/admin/setup.scripts'
su - admin -c 'chmod 755 /home/admin/setup.scripts/*.sh'
su - admin -c 'chmod 755 /home/admin/config.scripts/*.py'
echo "# ******************************************"
if [ "$2" != "" ]; then
exit 0
fi
fi
fi
# RASPIBLITZ API REPO
if [ "$2" == "api" ] || [ "$2" == "" ]; then
echo
echo "# ##### RASPIBLITZ API REPO"
# check if blitzapi service is enabled
systemctl is-enabled blitzapi 2>/dev/null
notInstalled=$?
#check if contains a raspiblitz API repo
containsApiRepo=$(ls /mnt/vm_shared_folder | grep -wc 'blitz_api')
if [ ${containsApiRepo} -eq 0 ]; then
echo "# /mnt/vm_shared_folder does not contain a api repo"
echo "# make sure to share the directory that contains the api repo - not the repo itself"
echo "# make sure its named 'blitz_api'"
if [ "$2" != "" ]; then
echo "error='no raspiblitz api repo'"
exit 1
fi
elif [ ${notInstalled} -gt 0 ]; then
echo "# blitzapi service is not installed or enabled - skipping"
if [ "$2" != "" ]; then
echo "error='blitzapi service not enabled'"
exit 1
fi
else
echo "# TODO: Not implemented yet - use /script/updateBlitzAPI.sh instead to sync from host to VM"
#echo "# Stopping blitzapi service"
#systemctl stop blitzapi
#echo "# COPYING from VM SHARED FOLDER to /home/blitzapi/"
#rm -rf /home/blitzapi/blitz_api
#cp -R /mnt/vm_shared_folder/blitz_api /home/blitzapi
#chown -R blitzapi:blitzapi /home/blitzapi/blitz_api
#cd /home/blitzapi/blitz_api || exit 1
#su - blitzapi -c './venv/bin/pip install -r requirements.txt'
#echo "# Starting blitzapi service"
#systemctl start blitzapi
if [ "$2" != "" ]; then
exit 0
fi
fi
fi
if [ "$1" == "sync" ]; then
exit 0
fi
# in case of unknown command
echo "error='unkown command'"
exit 1

View File

@ -178,7 +178,15 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# activeBranch detected by build_sdcard.sh: ${activeBranch}"
GITHUB_USER="${defaultAPIuser}"
GITHUB_REPO="${defaultAPIrepo}"
GITHUB_BRANCH="blitz-${githubBranch}"
# use dev branch when its an Release Candidate
source <(/home/admin/_cache.sh get codeVersion)
if [[ "$codeVersion" == *"rc"* ]]; then
echo "# RELEASE CANDIDATE: using dev branch"
GITHUB_BRANCH="dev"
else
GITHUB_BRANCH="blitz-${githubBranch}"
fi
GITHUB_COMMITORTAG=""
else
# get parameters

View File

@ -64,7 +64,15 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
source <(sudo /home/admin/build_sdcard.sh -EXPORT)
GITHUB_USER="${defaultWEBUIuser}"
GITHUB_REPO="${defaultWEBUIrepo}"
GITHUB_BRANCH="release/${githubBranch}"
# use master branch when its an Release Candidate
source <(/home/admin/_cache.sh get codeVersion)
if [[ "$codeVersion" == *"rc"* ]]; then
echo "# RELEASE CANDIDATE: using master branch"
GITHUB_BRANCH="master"
else
GITHUB_BRANCH="release/${githubBranch}"
fi
GITHUB_COMMITORTAG=""
else
# get parameters

View File

@ -3,22 +3,22 @@
# Based on: https://gist.github.com/normandmickey/3f10fc077d15345fb469034e3697d0d0
# https://github.com/dgarage/NBXplorer/tags
NBXplorerVersion="v2.5.0"
NBXplorerVersion="v2.5.2"
# https://github.com/btcpayserver/btcpayserver/releases
BTCPayVersion="v1.12.5"
BTCPayVersion="v1.13.0"
# check who signed the release (person that published release)
PGPsigner="nicolasdorier"
PGPpubkeyLink="https://keybase.io/nicolasdorier/pgp_keys.asc"
PGPpubkeyFingerprint="AB4CFA9895ACA0DBE27F6B346618763EF09186FE"
#PGPsigner="nicolasdorier"
#PGPpubkeyLink="https://keybase.io/nicolasdorier/pgp_keys.asc"
#PGPpubkeyFingerprint="AB4CFA9895ACA0DBE27F6B346618763EF09186FE"
# ---
#PGPsigner="Kukks"
#PGPpubkeyLink="https://github.com/${PGPsigner}.gpg"
#PGPpubkeyFingerprint="8E5530D9D1C93097"
# ---
#PGPsigner="web-flow"
#PGPpubkeyLink="https://github.com/web-flow.gpg"
#PGPpubkeyFingerprint="(4AEE18F83AFDEB23|B5690EEEBB952194)"
PGPsigner="web-flow"
PGPpubkeyLink="https://github.com/web-flow.gpg"
PGPpubkeyFingerprint="B5690EEEBB952194"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@ -861,12 +861,19 @@ if [ "$1" = "update" ]; then
TAG=$(git tag | sort -V | tail -1)
echo "# Reset to the latest release tag: $TAG"
sudo -u btcpay git reset --hard $TAG
PGPsigner="nicolasdorier"
PGPpubkeyLink="https://keybase.io/nicolasdorier/pgp_keys.asc"
PGPpubkeyFingerprint="AB4CFA9895ACA0DBE27F6B346618763EF09186FE"
sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
if ! sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}"; then
# try with webflow
PGPsigner="web-flow"
PGPpubkeyLink="https://github.com/web-flow.gpg"
PGPpubkeyFingerprint="B5690EEEBB952194"
sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
fi
echo "# Build NBXplorer $TAG"
# from the build.sh with path

View File

@ -0,0 +1,138 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# Switch charge-lnd on or off (experimental feature)"
echo "# needs to be switched on manually after every RaspiBlitz update/recovery for now"
echo "# config is stored in /mnt/hdd/app-data/charge-lnd/charge.config"
echo "# feedback: https://github.com/raspiblitz/raspiblitz/discussions/3955"
echo "# bonus.charge-lnd.sh [on|off]"
exit 1
fi
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# check if charge-lnd is already installed
isInstalled=$(sudo ls /etc/systemd/system/charge-lnd.service 2>/dev/null | grep -c 'charge-lnd.service')
if [ $isInstalled -gt 1 ]; then
echo "err='charge-lnd is already installed.'"
exit 1
fi
# install charge-lnd
echo "# Installing charge-lnd ..."
cd /home/bitcoin
sudo -u bitcoin git clone https://github.com/accumulator/charge-lnd.git
cd charge-lnd || exit 1
export CHARGE_LND_ENV=/home/bitcoin/charge-lnd
sudo -u bitcoin python3 -m venv ${CHARGE_LND_ENV}
sudo -u bitcoin ${CHARGE_LND_ENV}/bin/pip3 install -r requirements.txt .
# check if already a charge-lnd config exists
if [ -f /mnt/hdd/app-data/charge-lnd/charge.config ]; then
echo "# skipping charge-lnd config creation because it already exists."
else
# setting up charge-lnd config
echo "Setting up charge-lnd config ..."
sudo mkdir -p /mnt/hdd/app-data/charge-lnd
echo "
[discourage-routing-out-of-balance]
chan.max_ratio = 0.1
chan.min_capacity = 250000
strategy = static
base_fee_msat = 2000
fee_ppm = 690
[encourage-routing-to-balance]
chan.min_ratio = 0.9
chan.min_capacity = 250000
strategy = static
base_fee_msat = 1000
fee_ppm = 21
[default-proportional]
chan.max_ratio = 0.9
chan.min_ratio = 0.1
chan.min_capacity = 250000
strategy = proportional
min_fee_ppm = 21
max_fee_ppm = 210
base_fee_msat = 2000
" | sudo tee /mnt/hdd/app-data/charge-lnd/charge.config
fi
sudo chmod 770 -R /mnt/hdd/app-data/charge-lnd
sudo chown bitcoin:bitcoin -R /mnt/hdd/app-data/charge-lnd
# setting up systemd service
echo "# Setting up charge-lnd systemd service ..."
echo "
[Unit]
Description=charge-lnd
After=lnd.service
[Service]
ExecStart=/home/bitcoin/charge-lnd/bin/charge-lnd -c /mnt/hdd/app-data/charge-lnd/charge.config
User=bitcoin
Group=bitcoin
Type=simple
KillMode=process
TimeoutSec=60
[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/charge-lnd.service
# setting up systemd timer for hourly charge-lnd service
echo "# Setting up charge-lnd systemd timer ..."
echo "
[Unit]
Description=Runs charge-lnd every hour
[Timer]
OnBootSec=5min
OnUnitActiveSec=1h
[Install]
WantedBy=timers.target
" | sudo tee /etc/systemd/system/charge-lnd.timer
# enable timer because the service is only needed every hour once
sudo systemctl enable charge-lnd.timer
sudo systemctl start charge-lnd.timer
echo "# To check if timers are running use: sudo systemctl list-timers"
echo "# To check logs use: sudo journalctl -u charge-lnd"
echo "# To edit config: sudo nano /mnt/hdd/app-data/charge-lnd/charge.config"
echo "# Check options: https://github.com/accumulator/charge-lnd/blob/master/README.md"
echo "# feedback: https://github.com/raspiblitz/raspiblitz/discussions/3955"
echo "# charge-lnd installation done."
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# check if charge-lnd is installed
isInstalled=$(sudo ls /etc/systemd/system/charge-lnd.service 2>/dev/null | grep -c 'charge-lnd.service')
if [ $isInstalled -eq 0 ]; then
echo "err='charge-lnd is not installed.'"
exit 1
fi
echo "# Removing charge-lnd..."
sudo systemctl stop charge-lnd.timer
sudo systemctl disable charge-lnd.timer
sudo rm /etc/systemd/system/charge-lnd.service
sudo rm /etc/systemd/system/charge-lnd.timer
sudo rm -rf /home/bitcoin/charge-lnd
sudo rm -rf /mnt/hdd/app-data/charge-lnd
echo "# charge-lnd removal done."
exit 0
fi
echo "err='invalid parameter.'"
exit 1

View File

@ -32,16 +32,18 @@ if [ "$1" = "status" ]; then
if [ "${ElectRS}" = "on" ]; then
echo "configured=1"
echo "installed=1"
else
echo "configured=0"
echo "installed=0"
echo "infoSync='Service not installed'"
fi
if id "electrs" &>/dev/null; then
echo "installed=1"
else
echo "installed=0"
fi
#if id "electrs" &>/dev/null; then
# echo "installed=1"
#else
# echo "installed=0"
#fi
serviceInstalled=$(sudo systemctl status electrs --no-page 2>/dev/null | grep -c "electrs.service - Electrs")
serviceRunning=$(sudo systemctl status electrs --no-page 2>/dev/null | grep -c "active (running)")
@ -105,22 +107,6 @@ if [ "$1" = "status-sync" ]; then
echo "serviceRunning=${serviceRunning}"
if [ ${serviceRunning} -eq 1 ]; then
# Experimental try to get sync Info (electrs debug info would need more details)
#source <(/home/admin/_cache.sh get btc_mainnet_blocks_headers)
#blockchainHeight="${btc_mainnet_blocks_headers}"
#lastBlockchainHeight=$(($blockchainHeight -1))
#syncedToBlock=$(sudo journalctl -u electrs --no-pager -n2000 | grep "height=" | tail -n1| cut -d= -f3)
#syncProgress=0
#if [ "${syncedToBlock}" != "" ] && [ "${blockchainHeight}" != "" ] && [ "${blockchainHeight}" != "0" ]; then
# syncProgress="$(echo "$syncedToBlock" "$blockchainHeight" | awk '{printf "%.2f", $1 / $2 * 100}')"
#fi
#echo "syncProgress=${syncProgress}%"
#if [ "${syncedToBlock}" = "${blockchainHeight}" ] || [ "${syncedToBlock}" = "${lastBlockchainHeight}" ]; then
# echo "tipSynced=1"
#else
# echo "tipSynced=0"
#fi
# check if initial sync was done, by setting a file as once electrs is the first time responding on port 50001
electrumResponding=$(echo '{"jsonrpc":"2.0","method":"server.ping","params":[],"id":"electrs-check"}' | netcat -w 2 127.0.0.1 50001 | grep -c "result")
if [ ${electrumResponding} -gt 1 ]; then
@ -128,6 +114,27 @@ if [ "$1" = "status-sync" ]; then
fi
echo "electrumResponding=${electrumResponding}"
blockheight=0
blockheightPercent=0
if [ ${electrumResponding} -eq 0 ]; then
# get the synced blockheight
syncedBlock=$(echo '{"id": 1, "method": "blockchain.headers.subscribe", "params": []}' | nc -w 20 -q 1 localhost 50001 | jq '.result.height')
if [ "$syncedBlock" -eq "$syncedBlock" ] 2>/dev/null; then
blockheight=${syncedBlock}
# calculate the progress
source <(/home/admin/_cache.sh get btc_mainnet_blocks_verified)
if [ "$btc_mainnet_blocks_verified" -eq "$btc_mainnet_blocks_verified" ] 2>/dev/null; then
blockheightPercent=$(echo "scale=2; $syncedBlock / $btc_mainnet_blocks_verified * 100" | bc)
blockheightPercent=$(printf "%.0f\n" $blockheightPercent)
fi
fi
fi
echo "blockheight='${blockheight}'"
echo "blockheightPercent='${blockheightPercent}'"
fileFlagExists=$(sudo ls /mnt/hdd/app-storage/electrs/initial-sync.done 2>/dev/null | grep -c 'initial-sync.done')
if [ ${fileFlagExists} -eq 0 ] && [ ${electrumResponding} -gt 0 ]; then
# set file flag for the future
@ -137,7 +144,11 @@ if [ "$1" = "status-sync" ]; then
fi
if [ ${fileFlagExists} -eq 0 ]; then
echo "initialSynced=0"
echo "infoSync='Building Index (please wait)'"
if [ "${blockheightPercent}" != "0" ]; then
echo "infoSync='Building Index ${blockheightPercent}% (please wait)'"
else
echo "infoSync='Building Index (please wait)'"
fi
else
echo "initialSynced=1"
fi

View File

@ -0,0 +1,306 @@
#!/bin/bash
# set version (change if update is available)
# https://github.com/ElementsProject/elements/releases
VERSION="elements-23.2.1"
SIG_PUBKEY="BD0F3062F87842410B06A0432F656B0610604482" # Pablo Greco <pgreco@blockstream.com>
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo
echo "bonus.elements.sh install"
echo "bonus.elements.sh [on|off]"
echo "bonus.elements.sh addI2pSeedNodes"
echo "Installs $VERSION by default"
echo
exit 1
fi
echo "# Running: bonus.elements.sh $*"
source /mnt/hdd/raspiblitz.conf
# elementslogpath
elementslogpath="/home/elements/.elements/liquidv1/debug.log"
function addAlias {
echo "# Add aliases elements-cli, elementslog"
sudo -u admin touch /home/admin/_aliases
if ! grep "alias elements-cli" /home/admin/_aliases; then
echo "alias elements-cli=\"sudo -u elements /usr/local/bin/elements-cli -conf=/home/elements/.elements/elements.conf\"" |
sudo tee -a /home/admin/_aliases
fi
if ! grep "alias elementslog" /home/admin/_aliases; then
echo "alias elementslog=\"sudo -u elements tail -n 30 -f ${elementslogpath}\"" |
sudo tee -a /home/admin/_aliases
fi
if ! grep "alias elementsconf" /home/admin/_aliases; then
echo "alias elementsconf=\"sudo nano /home/elements/.elements/elements.conf\"" |
sudo tee -a /home/admin/_aliases
fi
sudo chown admin:admin /home/admin/_aliases
}
function installBinary {
echo "*** PREPARING ELEMENTS ***"
sudo adduser --system --group --shell /bin/bash --home /home/elements elements
# copy the skeleton files for login
sudo -u elements cp -r /etc/skel/. /home/elements/
# add to tor group
sudo adduser elements debian-tor
# prepare directories
sudo rm -rf /home/admin/download
sudo -u admin mkdir -p /home/admin/download/elements
cd /home/admin/download/elements || exit 1
echo "# Receive signer key"
gpg --recv-key ${SIG_PUBKEY} || exit 1
# download signed binary sha256 hash sum file
sudo -u admin wget --prefer-family=ipv4 --progress=bar:force -O SHA256SUMS https://github.com/ElementsProject/elements/releases/download/${VERSION}/SHA256SUMS
# download the signed binary sha256 hash sum file and check
sudo -u admin wget --prefer-family=ipv4 --progress=bar:force -O SHA256SUMS.asc https://github.com/ElementsProject/elements/releases/download/${VERSION}/SHA256SUMS.asc
if gpg --verify SHA256SUMS.asc; then
echo
echo "****************************************"
echo "OK --> ELEMENTS MANIFEST IS CORRECT"
echo "****************************************"
echo
else
echo
echo "# BUILD FAILED --> the PGP verification failed"
exit 1
fi
# elementsOSversion
if [ "$(uname -m | grep -c 'arm')" -gt 0 ]; then
elementsOSversion="arm-linux-gnueabihf"
elif [ "$(uname -m | grep -c 'aarch64')" -gt 0 ]; then
elementsOSversion="aarch64-linux-gnu"
elif [ "$(uname -m | grep -c 'x86_64')" -gt 0 ]; then
elementsOSversion="x86_64-linux-gnu"
fi
echo
echo "*** ELEMENTS v${VERSION} for ${elementsOSversion} ***"
# download resources
binaryName="${VERSION}-${elementsOSversion}.tar.gz"
if [ ! -f "./${binaryName}" ]; then
echo "# Downloading https://github.com/ElementsProject/elements/releases/download/${VERSION}/${binaryName} ..."
sudo -u admin wget --quiet https://github.com/ElementsProject/elements/releases/download/${VERSION}/${binaryName}
fi
if [ ! -f "./${binaryName}" ]; then
echo "# FAIL # Could not download the ELEMENTS BINARY"
exit 1
else
# check binary checksum test
echo "- checksum test"
# get the sha256 value for the corresponding platform from signed hash sum file
elementsSHA256=$(grep -i "${binaryName}" SHA256SUMS | cut -d " " -f1)
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1)
echo "Valid SHA256 checksum should be: ${elementsSHA256}"
echo "Downloaded binary SHA256 checksum: ${binaryChecksum}"
if [ "${binaryChecksum}" != "${elementsSHA256}" ]; then
echo "# FAIL # Downloaded ELEMENTS BINARY not matching SHA256 checksum: ${elementsSHA256}"
rm -v ./${binaryName}
exit 1
else
echo
echo "********************************************"
echo "OK --> VERIFIED ELEMENTS BINARY CHECKSUM"
echo "********************************************"
echo
sleep 10
echo
fi
fi
# install
sudo -u admin tar -xvf ${binaryName}
sudo install -m 0755 -o root -g root -t /usr/local/bin/ ${VERSION}/bin/*
sleep 3
if ! sudo /usr/local/bin/elementsd --version | grep "Elements Core version"; then
echo
echo "# BUILD FAILED --> Was not able to install ${VERSION}"
exit 1
fi
addAlias
echo "- Elements install OK"
}
function removeService() {
if [ -f "/etc/systemd/system/elementsd.service" ]; then
/usr/local/bin/elements-cli stop
sudo systemctl stop elementsd
sudo systemctl disable elementsd
sudo rm /etc/systemd/system/elementsd.service 2>/dev/null
echo "# Elements service is stopped and disabled"
fi
}
function installService() {
echo "# Prepare directories"
# symlink to elements home
sudo mkdir -p /mnt/hdd/app-data/.elements
# symlink
sudo rm -rf /home/elements/.elements # clean first
sudo ln -s /mnt/hdd/app-data/.elements /home/elements/
sudo chown -R elements:elements /mnt/hdd/app-data/.elements
sudo chown -R elements:elements /home/elements/
echo "# Installing Elements"
# elements.conf
if [ ! -f /home/elements/.elements/elements.conf ]; then
PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
echo "
# Elementsd configuration
datadir=/mnt/hdd/app-data/.elements
rpcuser=raspiblitz
rpcpassword=$PASSWORD_B
rpcbind=127.0.0.1
# Bitcoin Core credentials
mainchainrpcuser=raspibolt
mainchainrpcpassword=$PASSWORD_B
# Peer connection settings
onlynet=onion
proxy=127.0.0.1:9050
debug=tor
onlynet=i2p
i2psam=127.0.0.1:7656
i2pacceptincoming=1
debug=i2p
# initial sync does not work without clearnet
# disable when synced
onlynet=ipv4
onlynet=ipv6
" | sudo -u elements tee /home/elements/.elements/elements.conf
else
echo "# /home/elements/.elements/elements.conf is present"
fi
removeService
# /etc/systemd/system/elementsd.service
# based on https://github.com/elements/elements/blob/master/contrib/init/elementsd.service
echo "
[Unit]
Description=Elements daemon
[Service]
Environment='MALLOC_ARENA_MAX=1'
ExecStart=/usr/local/bin/elementsd -daemonwait -conf=/mnt/hdd/app-data/.elements/elements.conf
PermissionsStartOnly=true
# Process management
####################
Type=forking
Restart=on-failure
TimeoutStartSec=infinity
TimeoutStopSec=600
# Directory creation and permissions
####################################
# Run as elements:elements
User=elements
Group=elements
StandardOutput=null
StandardError=journal
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Deny access to /home, /root and /run/user
ProtectHome=true
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/elementsd.service
sudo systemctl daemon-reload
sudo systemctl enable elementsd
echo "# OK - the elementsd.service is now enabled"
addAlias
source <(/home/admin/_cache.sh get state)
if [ "${state}" == "ready" ]; then
echo "# OK - the elementsd.service is enabled, system is ready so starting service"
sudo systemctl start elementsd
else
echo "# OK - the elementsdservice is enabled, to start manually use:"
echo "sudo systemctl start elementsd"
fi
isInstalled=$(systemctl status elementsd | grep -c active)
if [ $isInstalled -gt 0 ]; then
echo "# Installed $(sudo -u elements elementsd --version | grep version)"
echo
echo "# Monitor the elementsd with:"
echo "# sudo tail -f /home/elements/.elements/debug.log"
echo
else
echo "# Installation failed"
echo "# See:"
echo "# sudo journalctl -fu elementsd"
exit 1
fi
}
# install
if [ "$1" = "install" ]; then
installBinary
exit 0
# switch on
elif [ "$1" = "1" ] || [ "$1" = "on" ]; then
if [ ! -f /usr/local/bin/elementsd ] || [ ! -d /home/elements ]; then
installBinary
fi
installService
# setting value in raspiblitz.conf
/home/admin/config.scripts/blitz.conf.sh set elements "on"
exit 0
# switch off
elif [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "# Uninstall Elements"
removeService
sudo userdel -rf elements
# setting value in raspiblitz.conf
/home/admin/config.scripts/blitz.conf.sh set elements "off"
exit 0
fi
echo "# FAIL - Unknown Parameter $1"
echo "# may need reboot to run"
exit 1

View File

@ -206,6 +206,7 @@ if [ "${mode}" = "on" ] || [ "${mode}" = "1" ]; then
Description=faraday
Wants=lnd.service
After=lnd.service
PartOf=lnd.service
[Service]
User=faraday

View File

@ -315,8 +315,8 @@ function downloadAndVerifyBinary() {
sudo rm -f /home/fulcrum/Fulcrum
sudo rm -f /home/fulcrum/FulcrumAdmin
# symlink
sudo ln -s /home/fulcrum/Fulcrum-${fulcrumVersion}-${build}/Fulcrum /home/fulcrum/ |
sudo ln -s /home/fulcrum/Fulcrum-${fulcrumVersion}-${build}/FulcrumAdmin /home/fulcrum/
sudo ln -s /home/fulcrum/Fulcrum-${fulcrumVersion}-${build}/Fulcrum /home/fulcrum/
sudo ln -s /home/fulcrum/Fulcrum-${fulcrumVersion}-${build}/FulcrumAdmin /home/fulcrum/
}
function createSystemdService() {

View File

@ -161,6 +161,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
Description=Helipad daemon
Wants=lnd.service
After=lnd.service
PartOf=lnd.service
[Service]
WorkingDirectory=$HELIPAD_BUILD_DIR/
ExecStart=$HELIPAD_BIN $HELIPAD_HTTP_PORT

View File

@ -0,0 +1,608 @@
#!/bin/bash
# path: /home/admin/config.scripts/bonus.labelbase.sh
APPID="labelbase"
VERSION="2.2.1"
GITHUB_REPO="https://github.com/Labelbase/Labelbase/"
GITHUB_TAG="2.2.1"
GITHUB_SIGN_AUTHOR=""
GITHUB_SIGN_PUBKEYLINK=""
GITHUB_SIGN_FINGERPRINT=""
# Basic variables
LABELBASE_HOME="/home/${APPID}/"
LABELBASE_DJANGO="/${LABELBASE_HOME}/${APPID}/django/"
LABELBASE_ENV="${LABELBASE_HOME}ENV/"
PORT_CLEAR="8089"
PORT_SSL="12349"
PORT_TOR_CLEAR="12350"
PORT_TOR_SSL="12351"
# BASIC COMMANDLINE OPTIONS
# you can add more actions or parameters if needed - for example see the bonus.rtl.sh
# to see how you can deal with an app that installs multiple instances depending on
# lightning implementation or testnets - but this should be OK for a start:
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to install, update or uninstall Labelbase"
echo "bonus.labelbase.sh [on|off|menu|update|status]"
echo "# bonus.${APPID}.sh status -> status information (key=value)"
echo "# bonus.${APPID}.sh on -> install the app"
echo "# bonus.${APPID}.sh off -> uninstall the app"
echo "# bonus.${APPID}.sh menu -> SSH menu dialog"
echo "# bonus.${APPID}.sh prestart -> will be called by systemd before start"
exit 1
fi
# echoing comments is useful for logs - but start output with # when not a key=value
echo "# Running: 'bonus.${APPID}.sh $*'"
# check & load raspiblitz config
source /mnt/hdd/raspiblitz.conf
if [ -f "${LABELBASE_HOME}/exports.sh" ]; then
echo "INFO: The file '${LABELBASE_HOME}/exports.sh' already exists."
source ${LABELBASE_HOME}/exports.sh
fi
#########################
# INFO
#########################
# this section is always executed to gather status information that
# all the following commands can use & execute on
# check if app is already installed
isInstalled=$(sudo ls /etc/systemd/system/${APPID}.service 2>/dev/null | grep -c "${APPID}.service")
# check if service is running
isRunning=$(systemctl status ${APPID} 2>/dev/null | grep -c 'active (running)')
if [ "${isInstalled}" == "1" ]; then
# gather address info (whats needed to call the app)
localIP=$(hostname -I | awk '{print $1}')
toraddress=$(sudo cat /mnt/hdd/tor/${APPID}/hostname 2>/dev/null)
fingerprint=$(openssl x509 -in /mnt/hdd/app-data/nginx/tls.cert -fingerprint -noout | cut -d"=" -f2)
fi
# if the action parameter `status` was called - just stop here and output all
# status information as a key=value list
if [ "$1" = "status" ]; then
echo "appID='${APPID}'"
echo "version='${VERSION}'"
echo "githubRepo='${GITHUB_REPO}'"
echo "githubVersion='${GITHUB_TAG}'"
echo "githubSignature='${GITHUB_SIGNATURE}'"
echo "isInstalled=${isInstalled}"
echo "isRunning=${isRunning}"
if [ "${isInstalled}" == "1" ]; then
echo "portCLEAR=${PORT_CLEAR}"
echo "portSSL=${PORT_SSL}"
echo "localIP='${localIP}'"
echo "toraddress='${toraddress}'"
echo "fingerprint='${fingerprint}'"
echo "toraddress='${toraddress}'"
fi
exit
fi
##########################
# MENU
#########################
# The `menu` action should give at least a SSH info dialog - when an webapp show
# URL to call (http & https+fingerprint) otherwise some instruction how to start it.
# This SSH dialog will be later called by the MAIN MENU to be available to the user
# when app is installed.
# This menu can also have some more complex structure if you want to make it easy
# to the user to set configurations or maintenance options - example bonus.lnbits.sh
# show info menu
if [ "$1" = "menu" ]; then
# set the title for the dialog
dialogTitle=" ${APPID} "
# basic info text - for an web app how to call with http & self-signed https
dialogText="Open in your local web browser:
http://${localIP}:${PORT_CLEAR}\n
https://${localIP}:${PORT_SSL} with Fingerprint:
${fingerprint}\n
"
# add tor info (if available)
if [ "${toraddress}" != "" ]; then
dialogText="${dialogText}Hidden Service address for Tor Browser (QRcode on LCD):\n${toraddress}"
fi
# use whiptail to show SSH dialog & exit
whiptail --title "${dialogTitle}" --msgbox "${dialogText}" 18 67
echo "please wait ..."
exit 0
fi
##########################
# ON / INSTALL
##########################
# This section takes care of installing the app.
# The template contains some basic steps but also look at other install scripts
# to see how special cases are solved.
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# dont run install if already installed
if [ ${isInstalled} -eq 1 ]; then
echo "# ${APPID}.service is already installed."
exit 1
fi
echo "# Installing ${APPID} ..."
# create a dedicated user for the app
# BACKGROUND is here to seperate running apps by unix users
# and only give file write access to the rest of the system where needed.
echo "# create user"
# If the user is intended to be loeed in to add '--shell /bin/bash'
# and copy the skeleton files
sudo adduser --system --group --shell /bin/bash --home /home/${APPID} ${APPID} || exit 1
# copy the skeleton files for login
sudo -u ${APPID} cp -r /etc/skel/. /home/${APPID}/
# add user to special groups with special access rights
# BACKGROUND there are some unix groups available that will give the access to
# like for example to the lnd admin macaroons - to check all groups available use:
# `cut -d: -f1 /etc/group | sort` command on raspiblitz commandline
#echo "# add use to special groups"
#sudo /usr/sbin/usermod --append --groups lndadmin ${APPID}
# create a data directory on /mnt/hdd/app-data/ for the app
# BACKGROUND is that any critical data that needs to survive an update should
# be stored in that app-data directory. All data there will also be part of
# any raspiblitz data migration. Also on install handle the case that there
# is already data from a pervious install available the user wants to
# continue to use and even may come from an older version from your app.
if ! [ -d /mnt/hdd/app-data/${APPID} ]; then
echo "# create app-data directory"
sudo mkdir /mnt/hdd/app-data/${APPID} 2>/dev/null
sudo chown ${APPID}:${APPID} -R /mnt/hdd/app-data/${APPID}
else
echo "# reuse existing app-directory"
sudo chown ${APPID}:${APPID} -R /mnt/hdd/app-data/${APPID}
fi
echo "# install from source code"
# make sure mysql/myria db is available & running
sudo apt-get install -y mariadb-server mariadb-client
sudo apt-get install -y \
default-libmysqlclient-dev \
build-essential \
cron vim logrotate \
libpcre3-dev \
default-mysql-client \
python3-pip \
virtualenv
sudo systemctl enable mariadb 2>/dev/null
sudo systemctl start mariadb 2>/dev/null
# download source code and verify
# BACKGROUND is that now you download the code from github, reset to a given version tag/commit,
# verify the author. If you app provides its source/binaries in another way, may check
# other install scripts to see how that implement code download & verify.
echo "# download the source code & verify"
sudo -u ${APPID} git clone ${GITHUB_REPO} /home/${APPID}/${APPID}
cd /home/${APPID}/${APPID}
if [ "${GITHUB_TAG}" != "" ]; then
sudo -u ${APPID} git reset --hard $GITHUB_TAG
fi
if [ "${GITHUB_SIGN_AUTHOR}" != "" ]; then
sudo -u ${APPID} /home/admin/config.scripts/blitz.git-verify.sh \
"${GITHUB_SIGN_AUTHOR}" "${GITHUB_SIGN_PUBKEYLINK}" "${GITHUB_SIGN_FINGERPRINT}" "${GITHUB_TAG}" || exit 1
fi
# compile/install the app
# BACKGROUND on this example is a web app that compiles with NodeJS. But of course
# your app could have a complete other way to install - check other install scripts as examples.
echo "# compile/install the app"
sudo pip install --upgrade pip
sudo -u ${APPID} virtualenv -p python3 ${LABELBASE_ENV}
sudo -u ${APPID} bash -c '. /home/labelbase/ENV/bin/activate && pip install --no-cache-dir -r /home/labelbase/labelbase/django/requirements.txt'
if [ -f "${LABELBASE_HOME}/exports.sh" ]; then
echo "INFO: The file '${LABELBASE_HOME}/exports.sh' already exists (232)."
else
sudo touch ${LABELBASE_HOME}/exports.sh
sudo chown ${APPID}:${APPID} ${LABELBASE_HOME}/exports.sh
sudo chmod 755 ${LABELBASE_HOME}/exports.sh
generate_password() {
openssl rand -base64 "${1:-16}" | tr -d '+/' | fold -w "${1:-16}" | head -n 1
}
MYSQL_PASSWORD=$(generate_password 32)
sudo -u ${APPID} bash -c "echo 'export MYSQL_PASSWORD=${MYSQL_PASSWORD}' > /home/labelbase/exports.sh"
fi
source ${LABELBASE_HOME}/exports.sh
isActive=$(sudo ls /etc/systemd/system/${APPID}.service 2>/dev/null | grep -c '${APPID}.service')
if [ ${isActive} -eq 0 ]; then
sudo mariadb -e "DROP DATABASE IF EXISTS labelbase;"
sudo mariadb -e "CREATE DATABASE labelbase;"
sudo mariadb -e "CREATE USER 'ulabelbase'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';"
sudo mariadb -e "GRANT ALL PRIVILEGES ON labelbase.* TO 'ulabelbase' IDENTIFIED BY '$MYSQL_PASSWORD';"
sudo mariadb -e "FLUSH PRIVILEGES;"
fi
# cd ${LABELBASE_DJANGO}
# sudo -u ${APPID} bash -c '. /home/labelbase/ENV/bin/activate && . /home/labelbase/exports.sh && /home/labelbase/labelbase/django/run.sh'
#sudo -u ${APPID} npm install --only=prod --logLevel warn
#if ! [ $? -eq 0 ]; then
# echo "# FAIL - npm install did not run correctly - deleting code & exit"
# sudo rm -r /home/${APPID}/${APPID}
# exit 1
# fi
# open the ports in the firewall
echo "# updating Firewall"
sudo ufw allow ${PORT_CLEAR} comment "${APPID} HTTP"
sudo ufw allow ${PORT_SSL} comment "${APPID} HTTPS"
# every app should have their own systemd service that cares about starting &
# running the app in the background - see the PRESTART section for adhoc config
# please config this systemd template to your needs
echo "# create systemd service: ${APPID}.service"
echo "
[Unit]
Description=${APPID}
Wants=bitcoind
After=bitcoind
[Service]
WorkingDirectory=/home/${APPID}
Environment=\"HOME_PATH=/mnt/hdd/app-data/${APPID}\"
ExecStartPre=-/home/admin/config.scripts/bonus.${APPID}.sh prestart
ExecStart=/home/admin/config.scripts/bonus.${APPID}.sh start
User=${APPID}
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal
# Hardening measures
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/${APPID}.service
sudo chown root:root /etc/systemd/system/${APPID}.service
# when tor is set on also install the hidden service
if [ "${runBehindTor}" = "on" ]; then
# activating tor hidden service
/home/admin/config.scripts/tor.onion-service.sh ${APPID} 80 ${PORT_TOR_CLEAR} 443 ${PORT_TOR_SSL}
fi
# nginx configuration
# BACKGROUND is that the plain HTTP is served by your web app, but thru the nginx proxy it will be available
# with (self-signed) HTTPS and with separate configs for Tor & Tor+HTTPS.
echo "# setup nginx confing"
# write the HTTPS config
echo "
server {
listen ${PORT_SSL} ssl;
listen [::]:${PORT_SSL} ssl;
server_name _;
include /etc/nginx/snippets/ssl-params.conf;
include /etc/nginx/snippets/ssl-certificate-app-data.conf;
access_log /var/log/nginx/access_${APPID}.log;
error_log /var/log/nginx/error_${APPID}.log;
location / {
proxy_pass http://127.0.0.1:${PORT_CLEAR};
include /etc/nginx/snippets/ssl-proxy-params.conf;
}
location /static {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
location /media {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
location /attachments/attachment {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
}
" | sudo tee /etc/nginx/sites-available/${APPID}_ssl.conf
sudo ln -sf /etc/nginx/sites-available/${APPID}_ssl.conf /etc/nginx/sites-enabled/
echo "
server {
listen ${PORT_TOR_CLEAR};
server_name localhost;
access_log /var/log/nginx/access_${APPID}.log;
error_log /var/log/nginx/error_${APPID}.log;
location / {
proxy_pass http://127.0.0.1:${PORT_CLEAR};
include /etc/nginx/snippets/ssl-proxy-params.conf;
}
location /static {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
location /media {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
location /attachments/attachment {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
" | sudo tee /etc/nginx/sites-available/${APPID}_tor.conf
sudo ln -sf /etc/nginx/sites-available/${APPID}_tor.conf /etc/nginx/sites-enabled/
# write the Tor+HTTPS config
echo "
server {
listen ${PORT_TOR_SSL} ssl;
server_name localhost;
include /etc/nginx/snippets/ssl-params.conf;
include /etc/nginx/snippets/ssl-certificate-app-data-tor.conf;
access_log /var/log/nginx/access_${APPID}.log;
error_log /var/log/nginx/error_${APPID}.log;
location / {
proxy_pass http://127.0.0.1:${PORT_CLEAR};
include /etc/nginx/snippets/ssl-proxy-params.conf;
}
location /static {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
location /media {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
location /attachments/attachment {
autoindex off;
index index.html;
root /home/labelbase/labelbase/django;
break;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
" | sudo tee /etc/nginx/sites-available/${APPID}_tor_ssl.conf
sudo ln -sf /etc/nginx/sites-available/${APPID}_tor_ssl.conf /etc/nginx/sites-enabled/
# test nginx config & activate thru reload
sudo nginx -t
sudo systemctl reload nginx
# mark app as installed in raspiblitz config
/home/admin/config.scripts/blitz.conf.sh set ${APPID} "on"
# enable app up thru systemd
sudo systemctl enable ${APPID}
echo "# OK - the ${APPID}.service is now enabled"
# start app (only when blitz is ready)
source <(/home/admin/_cache.sh get state)
if [ "${state}" == "ready" ]; then
sudo systemctl start ${APPID}
echo "# OK - the ${APPID}.service is now started"
fi
echo "# Monitor with: sudo journalctl -f -u ${APPID}"
exit 0
# OK so your app is now installed, but there please also check the following parts to ensure a propper integration
# into the raspiblitz system:
# PROVISION - reinstall on updates & recovery
# Take a look at `_provision_.sh` script - you can see that there all bonus apps install scripts get called if
# they have an active entry in the raspiblitz config. This is needed so that on sd card image update or recovery
# all apps get installed again. So add your app there accordantly so its install will survive an sd card update.
# MAINMENU - show users that app is installed
# Take a look at the `00mainmenu.sh` script - you can see there almost all bonus apps add a menu entry there if
# they are installed that then is calling this script with the `menu` parameter. Add your app accordingly.
# SERVICES MENU - add your app for onclick install
# Take a look at the `00settingsMenuServices.sh` script - you can there almost all bonus apps added themselves
# as an option in to be easily installed & deinstalled. Add your app there accordantly.
# DEBUGLOGS - add some status information
# Take a look at the `blitz.debug.sh` script - you can see there that apps if they are installed give some
# information on their latest logs and where to find them in the case that the user is searching for an error.
# So its best practice to also add your app there with some small info to help on debug & finding error logs.
# PRESTART & DEINSTALL
# see the following sections of the template
fi
##########################
# PRESTART
##########################
# BACKGROUND is that this script will be called with `prestart` on every start & restart
# of this apps systemd service. This has the benefit that right before the app is started
# config parameters for this app can be updated so that it always starts with the most updated
# values. With such an "adhoc config" it is for example possible to check right before start
# what other apps are installed and configure connections. Even if those configs outdate later
# while the app is running with the next restart they will then automatically update their config
# again. If you dont need such "adhoc" config for your app - just leave it empty as it is, so
# you maybe later on have the option to use it.
if [ "$1" = "start" ]; then
if [ "$USER" != "${APPID}" ]; then
echo "# FAIL: run as user ${APPID}"
exit 1
fi
if [ -f "${LABELBASE_HOME}/exports.sh" ]; then
cd ${LABELBASE_DJANGO}
echo "LABELBASE_DJANGO, pwd is ${LABELBASE_DJANGO}"
#sudo -u ${APPID} bash -c '
#source /home/labelbase/ENV/bin/activate && source /home/labelbase/exports.sh && /home/labelbase/labelbase/django/run_raspiblitz.sh
#'
source /home/labelbase/ENV/bin/activate && source /home/labelbase/exports.sh && /home/labelbase/ENV/bin/gunicorn labellabor.wsgi:application -b 0.0.0.0:${PORT_CLEAR} --reload
else
echo "Error: The file '${LABELBASE_HOME}/exports.sh' does not exists."
fi
fi
if [ "$1" = "prestart" ]; then
# needs to be run as the app user - stop if not run as the app user
# keep in mind that in the prestart section you cannot use `sudo` command
if [ "$USER" != "${APPID}" ]; then
echo "# FAIL: run as user ${APPID}"
exit 1
fi
echo "## PRESTART CONFIG START for ${APPID} (called by systemd prestart)"
if [ -f "${LABELBASE_HOME}/exports.sh" ]; then
cd ${LABELBASE_DJANGO}
source /home/labelbase/ENV/bin/activate
source /home/labelbase/exports.sh
python manage make_config
python manage.py makemigrations --noinput
python manage.py migrate --noinput
python manage.py collectstatic --noinput
python manage.py process_tasks &
else
echo "Error: The file '${LABELBASE_HOME}/exports.sh' does not exists."
fi
# so if you have anything to configure before service starts, do it here
echo "# no need for adhoc config needed so far"
echo "## PRESTART CONFIG DONE for ${APPID}"
exit 0
fi
###########################################
# OFF / UNINSTALL
# call with parameter `delete-data` to also
# delete the persistent data directory
###########################################
# BACKGROUND is that this section removes entries in systemd, nginx, etc and then
# deletes the user with its home directory to nuke all installed code
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "# stop & remove systemd service"
sudo systemctl stop ${APPID} 2>/dev/null
sudo systemctl disable ${APPID}.service
sudo rm /etc/systemd/system/${APPID}.service
echo "# remove nginx symlinks"
sudo rm -f /etc/nginx/sites-enabled/${APPID}_ssl.conf 2>/dev/null
sudo rm -f /etc/nginx/sites-enabled/${APPID}_tor.conf 2>/dev/null
sudo rm -f /etc/nginx/sites-enabled/${APPID}_tor_ssl.conf 2>/dev/null
sudo rm -f /etc/nginx/sites-available/${APPID}_ssl.conf 2>/dev/null
sudo rm -f /etc/nginx/sites-available/${APPID}_tor.conf 2>/dev/null
sudo rm -f /etc/nginx/sites-available/${APPID}_tor_ssl.conf 2>/dev/null
sudo nginx -t
sudo systemctl reload nginx
echo "# removed nginx symlinks"
echo "# close ports on firewall"
sudo ufw deny "${PORT_CLEAR}"
sudo ufw deny "${PORT_SSL}"
echo "# delete user"
sudo userdel -rf ${APPID}
echo "# removing Tor hidden service (if active)"
/home/admin/config.scripts/tor.onion-service.sh off ${APPID}
echo "# mark app as uninstalled in raspiblitz config"
/home/admin/config.scripts/blitz.conf.sh set ${APPID} "off"
# only if 'delete-data' is an additional parameter then also the data directory gets deleted
if [ "$(echo "$@" | grep -c delete-data)" -gt 0 ]; then
echo "# found 'delete-data' parameter --> also deleting the app-data"
sudo rm -r /mnt/hdd/app-data/${APPID}
fi
echo "# OK - Labelbase should be uninstalled now"
exit 0
fi
# just a basic error message when unknown action parameter was given
echo "# FAIL - Unknown Parameter $1"
exit 1
# LAST NOTES:
# Best is to contribute a new app install script as a PR to the raspiblitz GitHub repo.
# Please base your PR on the `dev` branch - not on the default branch displayed.

View File

@ -12,8 +12,9 @@ fi
source /mnt/hdd/raspiblitz.conf
ACME_LOAD_BASE_URL="https://codeload.github.com/acmesh-official/acme.sh/tar.gz"
ACME_VERSION="2.8.6"
# https://github.com/acmesh-official/acme.sh/releases
ACME_LOAD_BASE_URL="https://github.com/acmesh-official/acme.sh/archive/refs/tags/3.0.7.tar.gz"
ACME_VERSION="3.0.7"
ACME_INSTALL_HOME="/home/admin/.acme.sh"
ACME_CONFIG_HOME="/mnt/hdd/app-data/letsencrypt"
@ -21,19 +22,6 @@ ACME_CERT_HOME="${ACME_CONFIG_HOME}/certs"
ACME_IS_INSTALLED=0
# if Tor is on test that CURL is by default running over Tor
# TODO: issue https://github.com/rootzoll/raspiblitz/issues/1341
#if [ "${runBehindTor}" == "on" ]; then
# echo "# checking if Tor proxy for CURL is working ..."
# checkTor=$(curl -s https://check.torproject.org | grep -c "Congratulations")
# if [ ${checkTor} -eq 0 ]; then
# echo "err='curl tor proxy not working'"
# exit 1
# else
# echo "# OK Tor proxy for CURL"
# fi
#fi
###################
# FUNCTIONS
###################
@ -70,7 +58,15 @@ function acme_status() {
}
function acme_install() {
email="${1}"
# create a dummy email if none is provided
if [ -z "${email}" ]; then
random_number=$(shuf -i 100-999 -n 1)
random_word=$(shuf -n 1 /usr/share/dict/words)
ending="x.com"
email="${random_word}${random_number}@gm${ending}"
fi
# ensure socat
if ! command -v socat >/dev/null; then
@ -79,41 +75,38 @@ function acme_install() {
sudo apt-get install -y socat >/dev/null 2>&1
fi
# make sure config directory exists
if ! [ -d $ACME_CONFIG_HOME ]; then
sudo mkdir -p $ACME_CONFIG_HOME
fi
sudo chown admin:admin $ACME_CONFIG_HOME
rm -f "/tmp/acme.sh_${ACME_VERSION}.tar.gz"
if ! curl --silent --fail -o "/tmp/acme.sh_${ACME_VERSION}.tar.gz" "${ACME_LOAD_BASE_URL}/${ACME_VERSION}" 2>&1; then
echo "Error ($?): Download failed from: ${ACME_LOAD_BASE_URL}/${ACME_VERSION}"
rm -f "/tmp/acme.sh_${ACME_VERSION}.tar.gz"
# download and install acme.sh
echo "# download acme.sh release ${ACME_VERSION} from ${ACME_LOAD_BASE_URL}"
rm -r /tmp/acme.sh* 2>/dev/null
if ! curl -L --silent --fail -o "/tmp/acme.sh.tar.gz" "${ACME_LOAD_BASE_URL}" 2>&1; then
echo "Error ($?): Download failed from: ${ACME_LOAD_BASE_URL}"
rm -r /tmp/acme.sh*
exit 1
fi
if tar xzf "/tmp/acme.sh_${ACME_VERSION}.tar.gz" -C /tmp/; then
if tar xzf "/tmp/acme.sh.tar.gz" -C /tmp/; then
cd "/tmp/acme.sh-${ACME_VERSION}" || exit
if [ -n "${email}" ]; then
./acme.sh --install \
--noprofile \
--home "${ACME_INSTALL_HOME}" \
--config-home "${ACME_CONFIG_HOME}" \
--cert-home "${ACME_CERT_HOME}" \
--accountemail "${email}"
else
./acme.sh --install \
--noprofile \
--home "${ACME_INSTALL_HOME}" \
--config-home "${ACME_CONFIG_HOME}" \
--cert-home "${ACME_CERT_HOME}"
fi
echo "# installing acme.sh with email(${email})"
./acme.sh --install \
--noprofile \
--home "${ACME_INSTALL_HOME}" \
--config-home "${ACME_CONFIG_HOME}" \
--cert-home "${ACME_CERT_HOME}" \
--accountemail "${email}"
else
echo "# Error ($?): Extracting failed"
exit 1
fi
rm -f "/tmp/acme.sh_${ACME_VERSION}.tar.gz"
rm -Rf "/tmp/acme.sh_${ACME_VERSION}"
rm -r /tmp/acme.sh*
}
function refresh_certs_with_nginx() {
@ -219,6 +212,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo chmod -R 733 $ACME_CONFIG_HOME
# install the acme script
echo "# acme_install"
acme_install "${address}"
echo ""

View File

@ -90,6 +90,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
[Unit]
Description=LightningTipBot Service
After=lnd.service
PartOf=lnd.service
[Service]
WorkingDirectory=/home/lightningtipbot/LightningTipBot

View File

@ -1,7 +1,7 @@
#!/bin/bash
# https://github.com/lightninglabs/lightning-terminal/releases
LITVERSION="0.10.1-alpha"
LITVERSION="0.12.5-alpha"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then

View File

@ -3,7 +3,7 @@
# https://github.com/lnbits/lnbits
# https://github.com/lnbits/lnbits/releases
tag="0.11.3"
tag="0.12.8"
VERSION="${tag}"
# command info
@ -129,12 +129,12 @@ if [ "$1" = "menu" ]; then
# display possible problems with IP2TOR setup
if [ ${#ip2torWarn} -gt 0 ]; then
whiptail --title " Warning " \
--yes-button "Back" \
--no-button "Continue Anyway" \
--yesno "Your IP2TOR+LetsEncrypt may have problems:\n${ip2torWarn}\n\nCheck if locally responding: https://${localIP}:${httpsPort}\n\nCheck if service is reachable over Tor:\n${toraddress}" 14 72
--yes-button "Back" \
--no-button "Continue Anyway" \
--yesno "Your IP2TOR+LetsEncrypt may have problems:\n${ip2torWarn}\n\nCheck if locally responding: https://${localIP}:${httpsPort}\n\nCheck if service is reachable over Tor:\n${toraddress}" 14 72
if [ "$?" != "1" ]; then
exit 0
fi
fi
fi
# add info on funding source
@ -148,7 +148,7 @@ if [ "$1" = "menu" ]; then
text="https://${localIP}:${httpsPort}${authMethod}"
if [ ${#publicDomain} -gt 0 ]; then
text="${text}
text="${text}
Public Domain: https://${publicDomain}:${httpsPort}
port forwarding on router needs to be active & may change port"
fi
@ -201,8 +201,6 @@ Consider adding a IP2TOR Bridge under OPTIONS."
# just IP2TOR active - offer cancel or Lets Encrypt
OPTIONS+=(HTTPS-ON "Add free HTTPS-Certificate for LNbits")
OPTIONS+=(IP2TOR-OFF "Cancel IP2Tor Subscription for LNbits")
else
OPTIONS+=(IP2TOR-ON "Make Public with IP2Tor Subscription")
fi
# Change Funding Source options (only if available)
@ -225,139 +223,140 @@ Consider adding a IP2TOR Bridge under OPTIONS."
WIDTH=66
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+7))
HEIGHT=$((CHOICE_HEIGHT + 7))
CHOICE=$(dialog --clear \
--title " LNbits - Options" \
--ok-label "Select" \
--cancel-label "Back" \
--menu "Choose one of the following options:" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
--title " LNbits - Options" \
--ok-label "Select" \
--cancel-label "Back" \
--menu "Choose one of the following options:" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
case $CHOICE in
IP2TOR-ON)
python /home/admin/config.scripts/blitz.subscriptions.ip2tor.py create-ssh-dialog LNBITS ${toraddress} 443
exit 0
;;
IP2TOR-OFF)
clear
python /home/admin/config.scripts/blitz.subscriptions.ip2tor.py subscription-cancel ${ip2torID}
echo
echo "OK - PRESS ENTER to continue"
read key
exit 0
;;
HTTPS-ON)
python /home/admin/config.scripts/blitz.subscriptions.letsencrypt.py create-ssh-dialog
exit 0
;;
SWITCH-CL)
clear
/home/admin/config.scripts/bonus.lnbits.sh switch cl
echo "Restarting LNbits ..."
sudo systemctl restart lnbits
echo
echo "OK new funding source for LNbits active."
echo "PRESS ENTER to continue"
read key
exit 0
;;
SWITCH-LND)
clear
/home/admin/config.scripts/bonus.lnbits.sh switch lnd
echo "Restarting LNbits ..."
sudo systemctl restart lnbits
echo
echo "OK new funding source for LNbits active."
echo "PRESS ENTER to continue"
read key
exit 0
;;
BACKUP)
clear
/home/admin/config.scripts/bonus.lnbits.sh backup
echo
echo "Backup done"
echo "PRESS ENTER to continue"
read key
exit 0
;;
RESTORE)
clear
# check if backup exist
source <(/home/admin/_cache.sh get LNBitsDB)
if [ "${LNBitsDB}" == "PostgreSQL" ]; then
backup_target="/mnt/hdd/app-data/backup/lnbits_db"
backup_file=$(ls -t $backup_target/*.sql | head -n1)
else
backup_target="/mnt/hdd/app-data/backup/lnbits_sqlite"
backup_file=$(ls -t $backup_target/*.tar | head -n1)
fi
if [ "$backup_file" = "" ]; then
echo "ABORT - No Backup found to restore from"
exit 1
else
# build dialog to choose backup file from menu
OPTIONS_RESTORE=()
IP2TOR-ON)
python /home/admin/config.scripts/blitz.subscriptions.ip2tor.py create-ssh-dialog LNBITS ${toraddress} 443
exit 0
;;
IP2TOR-OFF)
clear
python /home/admin/config.scripts/blitz.subscriptions.ip2tor.py subscription-cancel ${ip2torID}
echo
echo "OK - PRESS ENTER to continue"
read key
exit 0
;;
HTTPS-ON)
python /home/admin/config.scripts/blitz.subscriptions.letsencrypt.py create-ssh-dialog
exit 0
;;
SWITCH-CL)
clear
/home/admin/config.scripts/bonus.lnbits.sh switch cl
echo "Restarting LNbits ..."
sudo systemctl restart lnbits
echo
echo "OK new funding source for LNbits active."
echo "PRESS ENTER to continue"
read key
exit 0
;;
SWITCH-LND)
clear
/home/admin/config.scripts/bonus.lnbits.sh switch lnd
echo "Restarting LNbits ..."
sudo systemctl restart lnbits
echo
echo "OK new funding source for LNbits active."
echo "PRESS ENTER to continue"
read key
exit 0
;;
BACKUP)
clear
/home/admin/config.scripts/bonus.lnbits.sh backup
echo
echo "Backup done"
echo "PRESS ENTER to continue"
read key
exit 0
;;
RESTORE)
clear
# check if backup exist
source <(/home/admin/_cache.sh get LNBitsDB)
if [ "${LNBitsDB}" == "PostgreSQL" ]; then
backup_target="/mnt/hdd/app-data/backup/lnbits_db"
backup_file=$(ls -t $backup_target/*.sql | head -n1)
else
backup_target="/mnt/hdd/app-data/backup/lnbits_sqlite"
backup_file=$(ls -t $backup_target/*.tar | head -n1)
fi
if [ "$backup_file" = "" ]; then
echo "ABORT - No Backup found to restore from"
exit 1
else
# build dialog to choose backup file from menu
OPTIONS_RESTORE=()
counter=0
cd $backup_target
for f in `find *.* -maxdepth 1 -type f`; do
[[ -f "$f" ]] || continue
counter=$(($counter+1))
OPTIONS_RESTORE+=($counter "$f")
done
counter=0
cd $backup_target
for f in $(find *.* -maxdepth 1 -type f); do
[[ -f "$f" ]] || continue
counter=$(($counter + 1))
OPTIONS_RESTORE+=($counter "$f")
done
WIDTH_RESTORE=66
CHOICE_HEIGHT_RESTORE=$(("${#OPTIONS_RESTORE[@]}/2+1"))
HEIGHT_RESTORE=$((CHOICE_HEIGHT_RESTORE+7))
CHOICE_RESTORE=$(dialog --clear \
--title " LNbits - Backup restore" \
--ok-label "Select" \
--cancel-label "Back" \
--menu "Choose one of the following backups:" \
$HEIGHT_RESTORE $WIDTH_RESTORE $CHOICE_HEIGHT_RESTORE \
"${OPTIONS_RESTORE[@]}" \
2>&1 >/dev/tty)
WIDTH_RESTORE=66
CHOICE_HEIGHT_RESTORE=$(("${#OPTIONS_RESTORE[@]}/2+1"))
HEIGHT_RESTORE=$((CHOICE_HEIGHT_RESTORE + 7))
CHOICE_RESTORE=$(dialog --clear \
--title " LNbits - Backup restore" \
--ok-label "Select" \
--cancel-label "Back" \
--menu "Choose one of the following backups:" \
$HEIGHT_RESTORE $WIDTH_RESTORE $CHOICE_HEIGHT_RESTORE \
"${OPTIONS_RESTORE[@]}" \
2>&1 >/dev/tty)
# start restore with selected backup
clear
if [ "$CHOICE_RESTORE" != "" ]; then
backup_file=${backup_target}/${OPTIONS_RESTORE[$(($CHOICE_RESTORE*2-1))]}
/home/admin/config.scripts/bonus.lnbits.sh restore "${backup_file}"
echo
echo "Restore done"
echo "PRESS ENTER to continue"
read key
fi
exit 0
fi
;;
MIGRATE-DB)
clear
dialog --title "MIGRATE LNBITS" --yesno "
# start restore with selected backup
clear
if [ "$CHOICE_RESTORE" != "" ]; then
backup_file=${backup_target}/${OPTIONS_RESTORE[$(($CHOICE_RESTORE * 2 - 1))]}
/home/admin/config.scripts/bonus.lnbits.sh restore "${backup_file}"
echo
echo "Restore done"
echo "PRESS ENTER to continue"
read key
fi
exit 0
fi
;;
MIGRATE-DB)
clear
dialog --title "MIGRATE LNBITS" --yesno "
Do you want to proceed the migration?
Try to migrate your LNBits SQLite database to PostgreSQL.
This can fail for unknown circumstances. Revert of this process is possible afterwards, a backup will be saved.
" 12 65
if [ $? -eq 0 ]; then
clear
/home/admin/config.scripts/bonus.lnbits.sh migrate
echo
migrateMsg
echo
echo "OK please test your LNBits installation."
echo "PRESS ENTER to continue"
read key
fi
exit 0
;;
*)
clear
exit 0
if [ $? -eq 0 ]; then
clear
/home/admin/config.scripts/bonus.lnbits.sh migrate
echo
migrateMsg
echo
echo "OK please test your LNBits installation."
echo "PRESS ENTER to continue"
read key
fi
exit 0
;;
*)
clear
exit 0
;;
esac
exit 0
@ -381,7 +380,7 @@ if [ "$1" = "status" ]; then
# auth method is to call with a certain useer id
#admin_userid=$(sudo cat /home/lnbits/lnbits/.super_user)
admin_userid=$(sudo cat /mnt/hdd/app-data/LNBits/data/.super_user);
admin_userid=$(sudo cat /mnt/hdd/app-data/LNBits/data/.super_user)
echo "authMethod='/wallet?usr=${admin_userid}'"
# check funding source
@ -534,7 +533,7 @@ if [ "$1" = "prestart" ]; then
# protect the admin user id if exists
# chmod 640 /home/lnbits/lnbits/.super_user 2>/dev/null
chmod 640 /mnt/hdd/app-data/LNBits/data/.super_user 2>/dev/null
chmod 640 /mnt/hdd/app-data/LNBits/data/.super_user 2>/dev/null
echo "# OK: prestart finished"
exit 0 # exit with clean code
@ -587,21 +586,22 @@ if [ "$1" = "sync" ] || [ "$1" = "repo" ]; then
# pull latest code
sudo -u lnbits git pull
# check if poetry in installed, if not install it
echo "# check if poetry in installed, if not install it"
if ! sudo -u lnbits which poetry; then
echo "# install poetry"
sudo pip3 install --upgrade pip
sudo pip3 install poetry
fi
# do install like this
echo "# install"
sudo -u lnbits poetry install
# make sure default virtaulenv is used
echo "# make sure the default virtualenv is used"
sudo apt-get remove -y python3-virtualenv 2>/dev/null
sudo pip uninstall -y virtualenv 2>/dev/null
sudo apt-get install -y python3-virtualenv
# restart lnbits service
echo "# restart lnbits service"
sudo systemctl restart lnbits
echo "# server is restarting ... maybe takes some seconds until available"
exit 0
@ -619,12 +619,6 @@ if [ "$1" = "install" ]; then
exit 0
fi
echo "# *** INSTALL LNBITS ${VERSION} ***"
# add lnbits user
echo "*** Add the 'lnbits' user ***"
sudo adduser --system --group --home /home/lnbits lnbits
# get optional github parameter
githubUser="lnbits"
if [ "$2" != "" ]; then
@ -634,17 +628,24 @@ if [ "$1" = "install" ]; then
tag="$3"
fi
echo "# *** INSTALL LNBITS ***"
echo "# githubUser=$githubUser tag=$tag"
# add lnbits user
echo "*** Add the 'lnbits' user ***"
sudo adduser --system --group --home /home/lnbits lnbits
# install from GitHub
echo "# get the github code user(${githubUser}) branch(${tag})"
sudo rm -r /home/lnbits/lnbits 2>/dev/null
cd /home/lnbits || exit 1
cd /home/lnbits || exit 1
sudo -u lnbits git clone https://github.com/${githubUser}/lnbits lnbits
cd /home/lnbits/lnbits || exit 1
sudo -u lnbits git checkout ${tag} || exit 1
# to the install
echo "# installing application dependencies"
cd /home/lnbits/lnbits || exit 1
cd /home/lnbits/lnbits || exit 1
# check if poetry in installed, if not install it
if ! sudo -u lnbits which poetry; then
@ -652,7 +653,8 @@ if [ "$1" = "install" ]; then
sudo pip3 install --upgrade pip
sudo pip3 install poetry
fi
# do install like this
echo "# install"
sudo -u lnbits poetry install
# make sure default virtaulenv is used
@ -681,7 +683,6 @@ if [ "$1" = "uninstall" ]; then
exit 0
fi
# on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
@ -790,7 +791,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# let switch command part do the detail config
/home/admin/config.scripts/bonus.lnbits.sh switch ${fundingsource}
cd /home/lnbits/lnbits || exit 1
cd /home/lnbits/lnbits || exit 1
# open firewall
echo
@ -799,6 +800,14 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo ufw allow 5001 comment 'lnbits HTTPS'
echo
# make sure that systemd starts funding source first
systemdDependency="bitcoind.service"
if [ "${fundingsource}" == "lnd" ]; then
systemdDependency="lnd.service"
elif [ "${fundingsource}" == "cl" ]; then
systemdDependency="lightningd.service"
fi
# install service
echo "*** Install systemd ***"
cat <<EOF | sudo tee /etc/systemd/system/lnbits.service >/dev/null
@ -806,8 +815,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
[Unit]
Description=lnbits
Wants=bitcoind.service
After=bitcoind.service
Wants=${systemdDependency}
After=${systemdDependency}
PartOf=${systemdDependency}
[Service]
WorkingDirectory=/home/lnbits/lnbits
@ -842,13 +852,13 @@ EOF
# setup nginx symlinks
if ! [ -f /etc/nginx/sites-available/lnbits_ssl.conf ]; then
sudo cp /home/admin/assets/nginx/sites-available/lnbits_ssl.conf /etc/nginx/sites-available/lnbits_ssl.conf
sudo cp /home/admin/assets/nginx/sites-available/lnbits_ssl.conf /etc/nginx/sites-available/lnbits_ssl.conf
fi
if ! [ -f /etc/nginx/sites-available/lnbits_tor.conf ]; then
sudo cp /home/admin/assets/nginx/sites-available/lnbits_tor.conf /etc/nginx/sites-available/lnbits_tor.conf
sudo cp /home/admin/assets/nginx/sites-available/lnbits_tor.conf /etc/nginx/sites-available/lnbits_tor.conf
fi
if ! [ -f /etc/nginx/sites-available/lnbits_tor_ssl.conf ]; then
sudo cp /home/admin/assets/nginx/sites-available/lnbits_tor_ssl.conf /etc/nginx/sites-available/lnbits_tor_ssl.conf
sudo cp /home/admin/assets/nginx/sites-available/lnbits_tor_ssl.conf /etc/nginx/sites-available/lnbits_tor_ssl.conf
fi
sudo ln -sf /etc/nginx/sites-available/lnbits_ssl.conf /etc/nginx/sites-enabled/
sudo ln -sf /etc/nginx/sites-available/lnbits_tor.conf /etc/nginx/sites-enabled/
@ -924,6 +934,10 @@ if [ "$1" = "switch" ]; then
exit 1
fi
# make lnd.service fallback
sudo sed -i 's/Wants=lnd.service/Wants=bitcoind.service/' /etc/systemd/system/lnbits.service
sudo sed -i 's/After=lnd.service/After=bitcoind.service/' /etc/systemd/system/lnbits.service
echo "##############"
echo "# NOTE: If you switch the funding source of a running LNbits instance all sub account will keep balance."
echo "# Make sure that the new funding source has enough sats to cover the LNbits bookeeping of sub accounts."
@ -1006,7 +1020,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
else
if (whiptail --title " DELETE DATA? " --yesno "Do you want to delete\nthe LNbits Server Data?" 8 30); then
deleteData=1
else
else
deleteData=0
fi
fi
@ -1069,7 +1083,7 @@ if [ "$1" = "backup" ]; then
else
# sqlite backup
backup_target="/mnt/hdd/app-data/backup/lnbits_sqlite"
backup_file="lnbits_sqlite_`date +%d`-`date +%m`-`date +%Y`_`date +%H`-`date +%M`_fs.tar"
backup_file="lnbits_sqlite_$(date +%d)-$(date +%m)-$(date +%Y)_$(date +%H)-$(date +%M)_fs.tar"
if [ ! -d $backup_target ]; then
sudo mkdir -p $backup_target 1>&2
fi
@ -1191,9 +1205,8 @@ if [ "$1" = "migrate" ]; then
# execStartPre is not enough, wait for lnbits is finally running
count=0
count_max=30
while ! nc -zv 127.0.0.1 5000 2>/dev/null;
do
count=`expr $count + 1`
while ! nc -zv 127.0.0.1 5000 2>/dev/null; do
count=$(expr $count + 1)
echo "wait for LNBIts to start (${count}s/${count_max}s)"
sleep 1
if [ $count = $count_max ]; then

View File

@ -46,6 +46,7 @@ protocol.custom-init=39
echo "[Unit]
Description=lndk Service
After=lnd.service
PartOf=lnd.service
[Service]
ExecStart=/home/bitcoin/lndk/target/debug/lndk --address=https://localhost:10009 --cert=/mnt/hdd/lnd/tls.cert --macaroon=/mnt/hdd/lnd/data/chain/bitcoin/mainnet/admin.macaroon

View File

@ -9,7 +9,7 @@ fi
# set version of LND manage to install
# https://github.com/bitromortac/lndmanage/releases
lndmanageVersion="0.15.0"
lndmanageVersion="0.16.0"
pgpKeyDownload="https://github.com/bitromortac.gpg"
gpgFingerprint="0453B9F5071261A40FDB34181965063FC13BEBE2"

View File

@ -114,6 +114,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
[Unit]
Description=Loopd Service
After=lnd.service
PartOf=lnd.service
[Service]
WorkingDirectory=/home/loop/loop

View File

@ -41,18 +41,23 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# install hexyl
sudo apt-get install -y hexyl html2text
## WORKAROUND: see https://github.com/raspiblitz/raspiblitz/issues/4383
# install via pip
# sudo -u pyblock pip3 install pybitblock
# install from github
sudo -u pyblock git clone https://github.com/curly60e/pyblock.git
cd pyblock
sudo -u pyblock git checkout v2.2.3
sudo -u pyblock sed -i 's/jq = "1.2.2"/jq = "1.2.3"/' pyproject.toml
sudo -u pyblock pip install .
sudo -u pyblock git checkout v2.7.2
sudo -u pyblock sed -i 's/^python =.*$/python = ">=3.11,<4.0"/' pyproject.toml
sudo -u pyblock poetry lock
sudo -u pyblock poetry install
envPath=$(sudo -u pyblock poetry env info --path)
# sudo -u pyblock ${envPath}/bin/pip uninstall -y typer click
# sudo -u pyblock ${envPath}/bin/pip install typer==0.4.0 click==8.0.0
# set PATH for the user
sudo bash -c "echo 'PATH=\$PATH:/home/pyblock/.local/bin/' >> /home/pyblock/.profile"
sudo bash -c "echo 'PATH=\$PATH:${envPath}/bin' >> /home/pyblock/.profile"
# add user to group with admin access to lnd
sudo /usr/sbin/usermod --append --groups lndadmin pyblock

View File

@ -48,8 +48,16 @@ echo "# RTLHTTP(${RTLHTTP})"
# construct needed variable elements
configEntry="${netprefix}${typeprefix}rtlWebinterface"
systemdService="${netprefix}${typeprefix}RTL"
dependsOn="bitcoind"
if [ "${LNTYPE}" == "cl" ]; then
dependsOn="${netprefix}lightningd"
elif [ "${LNTYPE}" == "lnd" ]; then
dependsOn="${netprefix}lnd"
fi
echo "# configEntry(${configEntry})"
echo "# systemdService(${systemdService})"
echo "# dependsOn(${dependsOn})"
##########################
# MENU
@ -271,8 +279,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
[Unit]
Description=${systemdService} Webinterface
Wants=
After=
Wants=${dependsOn}.service
After=${dependsOn}.service
PartOf=${dependsOn}.service
[Service]
Environment=\"RTL_CONFIG_PATH=/mnt/hdd/app-data/rtl/${systemdService}/\"
@ -297,19 +306,8 @@ WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/${systemdService}.service
sudo chown root:root /etc/systemd/system/${systemdService}.service
# adapt systemd service template for LND
if [ "${LNTYPE}" == "lnd" ]; then
echo "# modifying ${systemdService}.service for LND"
sudo sed -i "s/^Wants=.*/Wants=${netprefix}lnd.service/g" /etc/systemd/system/${systemdService}.service
sudo sed -i "s/^After=.*/After=${netprefix}lnd.service/g" /etc/systemd/system/${systemdService}.service
fi
# adapt systemd service template for
# set up Core LightningREST (if needed)
if [ "${LNTYPE}" == "cl" ]; then
echo "# modifying ${systemdService}.service for CL"
sudo sed -i "s/^Wants=.*/Wants=${netprefix}lightningd.service/g" /etc/systemd/system/${systemdService}.service
sudo sed -i "s/^After=.*/After=${netprefix}lightningd.service/g" /etc/systemd/system/${systemdService}.service
# set up Core LightningREST
/home/admin/config.scripts/cl.rest.sh on ${CHAIN}
fi

View File

@ -1,7 +1,7 @@
#!/bin/bash
# https://github.com/cryptoadvance/specter-desktop
pinnedVersion="1.13.1"
pinnedVersion="2.0.4"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@ -131,7 +131,7 @@ function configure_specter {
"proxy_url": "${proxy}",
"only_tor": "${torOnly}",
"tor_control_port": "${tor_control_port}",
"tor_status": true,
"tor_status": false,
"hwi_bridge_url": "/hwi/api/"
}
EOF
@ -146,6 +146,8 @@ EOF
echo "# Connect Specter to the default mainnet node"
cat >/home/admin/default.json <<EOF
{
"python_class": "cryptoadvance.specter.node.Node",
"fullpath": "/home/specter/.specter/nodes/default.json"
"name": "raspiblitz_mainnet",
"alias": "default",
"autodetect": false,
@ -155,8 +157,6 @@ EOF
"port": "8332",
"host": "localhost",
"protocol": "http",
"external_node": true,
"fullpath": "/home/specter/.specter/nodes/default.json"
}
EOF
sudo mv /home/admin/default.json /home/specter/.specter/nodes/default.json
@ -176,7 +176,7 @@ EOF
"name": "raspiblitz_${chain}net",
"alias": "raspiblitz_${chain}net",
"autodetect": false,
"datadir": "",
"datadir": "/mnt/hdd/bitcoin",
"user": "${RPCUSER}",
"password": "${PASSWORD_B}",
"port": "${PORT}",
@ -238,6 +238,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# --> creating a virtualenv"
sudo -u specter virtualenv --python=python3 /home/specter/.env
sudo -u specter /home/specter/.env/bin/python3 -m pip install --upgrade pip
echo "# --> pip-installing specter"
sudo -u specter /home/specter/.env/bin/python3 -m pip install --upgrade cryptoadvance.specter==$pinnedVersion || exit 1

View File

@ -1,17 +1,21 @@
#!/bin/bash
# deprecated May 2024
# see or comment on: https://github.com/raspiblitz/raspiblitz/issues/2558
# https://github.com/stakwork/sphinx-relay
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to switch Sphinx-Relay on,off or update"
echo "The Sphinx-Relay is deprecated and may be removed in future versions."
echo "Needs to be manual installed manually after every update/recover"
echo "bonus.sphinxrelay.sh on [?GITHUBUSER] [?BRANCH]"
echo "bonus.sphinxrelay.sh [off|status|menu|write-environment|update]"
echo "# DEVELOPMENT: TO SYNC WITH YOUR FORKED GITHUB-REPO"
echo "bonus.sphinxrelay.sh github sync"
exit 1
fi
source /mnt/hdd/raspiblitz.conf
# show info menu
@ -384,7 +388,12 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
/home/admin/config.scripts/bonus.nodejs.sh on
# make sure keysend is on
/home/admin/config.scripts/lnd.keysend.sh on
keysendOn=$(cat /mnt/hdd/lnd/lnd.conf | grep -c '^accept-keysend=1')
if [ "${keysendOn}" == "0" ]; then
echo "ERR: keysend is not activated in LND"
echo "Activate it in the LND config and restart LND"
exit 1
fi
echo "*** Add the 'sphinxrelay' user ***"
sudo adduser --system --group --home /home/sphinxrelay sphinxrelay

View File

@ -1,225 +0,0 @@
#!/bin/bash
# https://github.com/djbooth007/tallycoin_connect
USERNAME=tallycoin
APP_DATA_DIR=/mnt/hdd/app-data/tallycoin-connect
HOME_DIR=/home/$USERNAME
CONFIG_FILE=$APP_DATA_DIR/tallycoin_api.key
RASPIBLITZ_INFO=/home/admin/raspiblitz.info
SERVICE_FILE=/etc/systemd/system/tallycoin-connect.service
TC_VERSION=1.8.0
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to switch tallycoin_connect on or off"
echo "bonus.tallycoin-connect.sh [on|off|menu]"
exit 1
fi
# check and load raspiblitz config to know which network is running
source $RASPIBLITZ_INFO
source /mnt/hdd/raspiblitz.conf
# show info menu
if [ "$1" = "menu" ]; then
# get network info
localip=$(hostname -I | awk '{print $1}')
toraddress=$(sudo cat /mnt/hdd/tor/tallycoin-connect/hostname 2>/dev/null)
fingerprint=$(openssl x509 -in /mnt/hdd/app-data/nginx/tls.cert -fingerprint -noout | cut -d"=" -f2)
if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then
# Info with TOR
sudo /home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
whiptail --title " Tallycoin Connect " --msgbox "Open in your local web browser:
http://${localip}:8123\n
https://${localip}:8124 with Fingerprint:
${fingerprint}\n
Use your Password B to login.\n
Hidden Service address for TOR Browser (see LCD for QR):\n${toraddress}
" 16 72
sudo /home/admin/config.scripts/blitz.display.sh hide
else
# Info without TOR
whiptail --title " Tallycoin Connect " --msgbox "Open in your local web browser & accept self-signed cert:
http://${localip}:8123\n
https://${localip}:8124 with Fingerprint:
${fingerprint}\n
Use your Password B to login.\n
Activate TOR to access the web interface from outside your local network.
" 15 72
fi
echo "please wait ..."
exit 0
fi
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c 'tallycoin_connect')
if [ ${isInstalled} -eq 0 ]; then
echo "*** INSTALL TALLYCOIN CONNECT ***"
# install nodeJS
/home/admin/config.scripts/bonus.nodejs.sh on
# add user
sudo adduser --system --group --home /home/$USERNAME $USERNAME
# install tallycoin_connect
cd $HOME_DIR
sudo -u $USERNAME wget https://github.com/djbooth007/tallycoin_connect/archive/refs/tags/v$TC_VERSION.tar.gz
sudo -u $USERNAME tar -xzf v$TC_VERSION.tar.gz
sudo -u $USERNAME mv tallycoin_connect{-$TC_VERSION,}
sudo -u $USERNAME rm v$TC_VERSION.tar.gz
cd tallycoin_connect
sudo -u $USERNAME cat .dockerignore | sudo -u $USERNAME xargs sudo -u $USERNAME rm -rf
sudo -u $USERNAME rm .dockerignore
sudo -u $USERNAME npm install
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
# setup config
sudo mkdir -p $APP_DATA_DIR
sudo chown $USERNAME:$USERNAME $APP_DATA_DIR
if [[ ! -f "$CONFIG_FILE" ]]; then
configFile=/home/admin/tallycoin_api.key
touch $configFile
sudo chmod 600 $configFile || exit 1
passwordB=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
passwd=$(printf $passwordB | sha256sum | tr -d ' -')
tlsCert=$(base64 /mnt/hdd/app-data/lnd/tls.cert | tr -d '=' | tr '/+' '_-' | tr -d '\n')
macaroon=$(base64 /mnt/hdd/app-data/lnd/data/chain/${network}/${chain}net/admin.macaroon | tr -d '=' | tr '/+' '_-' | tr -d '\n')
echo "{\"tls_cert\":\"$tlsCert\",\"macaroon\":\"$macaroon\",\"tallycoin_passwd\":\"$passwd\"}" > $configFile
sudo mv $configFile $CONFIG_FILE
sudo chown $USERNAME:$USERNAME $CONFIG_FILE
fi
##################
# NGINX
##################
# setup nginx symlinks
if ! [ -f /etc/nginx/sites-available/tallycoin_connect_ssl.conf ]; then
sudo cp -f /home/admin/assets/nginx/sites-available/tallycoin_connect_ssl.conf /etc/nginx/sites-available/tallycoin_connect_ssl.conf
fi
if ! [ -f /etc/nginx/sites-available/tallycoin_connect_tor.conf ]; then
sudo cp /home/admin/assets/nginx/sites-available/tallycoin_connect_tor.conf /etc/nginx/sites-available/tallycoin_connect_tor.conf
fi
if ! [ -f /etc/nginx/sites-available/tallycoin_connect_tor_ssl.conf ]; then
sudo cp /home/admin/assets/nginx/sites-available/tallycoin_connect_tor_ssl.conf /etc/nginx/sites-available/tallycoin_connect_tor_ssl.conf
fi
sudo ln -sf /etc/nginx/sites-available/tallycoin_connect_ssl.conf /etc/nginx/sites-enabled/
sudo ln -sf /etc/nginx/sites-available/tallycoin_connect_tor.conf /etc/nginx/sites-enabled/
sudo ln -sf /etc/nginx/sites-available/tallycoin_connect_tor_ssl.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
# open the firewall
echo "*** Updating Firewall ***"
sudo ufw allow from any to any port 8123 comment 'allow Tallycoin Connect HTTP'
sudo ufw allow from any to any port 8124 comment 'allow Tallycoin Connect HTTPS'
echo ""
##################
# SYSTEMD SERVICE
##################
echo "# Install Tallycoin Connect systemd for ${network} on ${chain}"
echo "
# Systemd unit for Tallycoin Connect
[Unit]
Description=Tallycoin Connect daemon
Wants=lnd.service
After=lnd.service
[Service]
WorkingDirectory=$HOME_DIR/tallycoin_connect
Environment=\"CONFIG_FILE=$CONFIG_FILE\"
ExecStart=/usr/bin/npm start
User=tallycoin
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal
# Hardening measures
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target
" | sudo tee $SERVICE_FILE
sudo systemctl enable tallycoin-connect
# setting value in raspiblitz config
/home/admin/config.scripts/blitz.conf.sh set tallycoinConnect "on"
# Hidden Service for tallycoin-connect if Tor is active
if [ "${runBehindTor}" = "on" ]; then
# make sure to keep in sync with tor.onion-service.sh script
/home/admin/config.scripts/tor.onion-service.sh tallycoin-connect 80 8125 443 8126
fi
source $RASPIBLITZ_INFO
if [ "${state}" == "ready" ]; then
echo "# OK - the tallycoin-connect.service is enabled, system is ready so starting service"
sudo systemctl start tallycoin-connect
else
echo "# OK - the tallycoin-connect.service is enabled, to start manually use: 'sudo systemctl start tallycoin-connect'"
fi
else
echo "*** TALLYCOIN CONNECT ALREADY INSTALLED ***"
fi
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c 'tallycoin_connect')
if [ ${isInstalled} -eq 1 ]; then
echo "*** UNINSTALL TALLYCOIN CONNECT ***"
# remove systemd service
sudo systemctl stop tallycoin-connect
sudo systemctl disable tallycoin-connect
sudo rm -f $SERVICE_FILE
# close ports on firewall
sudo ufw delete allow from any to any port 8123 comment 'allow Tallycoin Connect HTTP'
sudo ufw delete allow from any to any port 8124 comment 'allow Tallycoin Connect HTTPS'
# remove nginx symlinks
sudo rm -f /etc/nginx/sites-enabled/tallycoin_connect_*
sudo nginx -t
sudo systemctl reload nginx
# Hidden Service if Tor is active
if [ "${runBehindTor}" = "on" ]; then
/home/admin/config.scripts/tor.onion-service.sh off tallycoin-connect
fi
# remove config
sudo rm -rf $APP_DATA_DIR
# delete user and home directory
sudo userdel -rf $USERNAME
# setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set tallycoinConnect "off"
echo "OK TALLYCOIN CONNECT removed."
else
echo "*** TALLYCOIN CONNECT NOT INSTALLED ***"
fi
exit 0
fi
echo "FAIL - Unknown Parameter $1"
exit 1

View File

@ -0,0 +1,44 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo
echo "Install and show the output if the summars plugin for Core Lightning"
echo "Usage:"
echo "cl-plugin.summars.sh [testnet|mainnet|signet] [runonce]"
echo
exit 1
fi
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
if [ $($lightningcli_alias | grep -c "summars") -eq 0 ]; then
echo "# Starting the summars plugin"
if [ ! -f /home/bitcoin/cl-plugins-available/summars/target/release/summars ]; then
if [ ! -f /home/bitcoin/.cargo/bin/cargo ]; then
# get Rust
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u bitcoin sh -s -- -y
fi
if [ ! -d "/home/bitcoin/cl-plugins-available/summars" ]; then
sudo -u bitcoin mkdir /home/bitcoin/cl-plugins-available 2>/dev/null
cd /home/bitcoin/cl-plugins-available || exit 1
sudo -u bitcoin git clone https://github.com/daywalker90/summars.git
fi
cd /home/bitcoin/cl-plugins-available/summars || exit 1
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build --release
fi
$lightningcli_alias plugin start -H /home/bitcoin/cl-plugins-available/summars/target/release/summars 1>/dev/null
fi
echo
echo "# Running:"
echo "${netprefix}lightning-cli -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS"
echo
$lightningcli_alias -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS
echo
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ]; then
$lightningcli_alias plugin stop /home/bitcoin/cl-plugins-available/summars/target/release/summars
fi

View File

@ -1,45 +0,0 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
echo
echo "Install and show the output if the summary plugin forCore Lightning"
echo "Usage:"
echo "cl-plugin.summary.sh [testnet|mainnet|signet] [runonce]"
echo
exit 1
fi
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
if [ ! -f "/home/bitcoin/cl-plugins-available/plugins/summary/summary.py" ]; then
sudo -u bitcoin mkdir /home/bitcoin/cl-plugins-available
cd /home/bitcoin/cl-plugins-available || exit 1
sudo -u bitcoin git clone https://github.com/lightningd/plugins.git
fi
if [ $($lightningcli_alias | grep -c "summary") -eq 0 ];then
echo "# Starting the summary plugin"
# https://github.com/ElementsProject/lightning/tree/master/contrib/pylightning
sudo -u bitcoin pip install --user pylightning 1>/dev/null
# https://github.com/lightningd/plugins#dynamic-plugin-initialization
sudo -u bitcoin pip install --user -r /home/bitcoin/cl-plugins-available/plugins/summary/requirements.txt 1>/dev/null
$lightningcli_alias plugin start -H /home/bitcoin/cl-plugins-available/plugins/summary/summary.py 1>/dev/null
fi
echo
echo "Node URI:"
ln_getinfo=$($lightningcli_alias -H getinfo 2>/dev/null)
pubkey=$(echo "$ln_getinfo" | grep "id=" | cut -d= -f2)
toraddress=$(echo "$ln_getinfo" | grep ".onion" | cut -d= -f2)
port=$(echo "$ln_getinfo" | grep "port" | tail -n1 | cut -d= -f2)
echo "${pubkey}@${toraddress}:${port}"
echo
echo "# Running:"
echo "${netprefix}lightning-cli -H summary"
echo
$lightningcli_alias -H summary
echo
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ];then
$lightningcli_alias plugin stop /home/bitcoin/cl-plugins-available/plugins/summary/summary.py
fi

View File

@ -49,6 +49,7 @@ echo "
Description=c-lightning daemon on $CHAIN
Requires=${netprefix}bitcoind.service
After=${netprefix}bitcoind.service
PartOf=${netprefix}bitcoind.service
Wants=network-online.target
After=network-online.target

View File

@ -1,60 +0,0 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "small config script to switch the LND auto pilot on or off"
echo "lnd.autopilot.sh [on|off]"
exit 1
fi
# check lnd.conf exits
lndConfExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c 'lnd.conf')
if [ ${lndConfExists} -eq 0 ]; then
echo "FAIL - /mnt/hdd/lnd/lnd.conf not found"
exit 1
fi
# stop services
echo "making sure services are not running"
sudo systemctl stop lnd 2>/dev/null
# check if "autopilot.active" exists
valueExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'autopilot.active=')
if [ ${valueExists} -eq 0 ]; then
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
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
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"
/home/admin/config.scripts/blitz.conf.sh set autoPilot "on"
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 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"
/home/admin/config.scripts/blitz.conf.sh set autoPilot "off"
echo "OK - autopilot is now OFF"
echo "needs reboot to activate new setting"
exit 0
fi
echo "FAIL - Unknown Parameter $1"
echo "may needs reboot to run normal again"
exit 1

View File

@ -69,7 +69,7 @@ if [ "$1" == "prestart" ]; then
##### APPLICATION OPTIONS SECTION #####
# remove sync-freelist=1 (use =true is you want to overrule raspiblitz)
# remove sync-freelist=1 (use =true if you want to overrule raspiblitz)
# https://github.com/rootzoll/raspiblitz/issues/3251
sed -i "/^# Avoid slow startup time/d" ${lndConfFile}
sed -i "/^sync-freelist=1/d" ${lndConfFile}
@ -213,11 +213,6 @@ if [ "$1" == "prestart" ]; then
sed -i '/^externalip=*/d' ${lndConfFile}
fi
# enforce LND keysend (if set in raspiblitz.conf)
if [ "${lndKeysend}" == "on" ]; then
setting ${lndConfFile} ${insertLine} "accept-keysend" "true"
fi
##### BOLT SECTION #####
# https://github.com/lightningnetwork/lnd/blob/0aa0831619cb320dbb74883c37a80ccbdde7f320/sample-lnd.conf#L1205
sectionName="bolt"

View File

@ -4,7 +4,7 @@
## based on https://raspibolt.github.io/raspibolt/raspibolt_40_lnd.html#lightning-lnd
## see LND releases: https://github.com/lightningnetwork/lnd/releases
### If you change here - make sure to also change interims version in lnd.update.sh #!
lndVersion="0.17.3-beta"
lndVersion="0.17.5-beta"
# olaoluwa
PGPauthor="roasbeef"
@ -306,13 +306,20 @@ debuglevel=info
gc-canceled-invoices-on-startup=true
gc-canceled-invoices-on-the-fly=true
ignore-historical-gossip-filters=1
sync-freelist=true
stagger-initial-reconnect=true
tlsautorefresh=1
tlsdisableautofill=1
tlscertpath=/home/bitcoin/.lnd/tls.cert
tlskeypath=/home/bitcoin/.lnd/tls.key
# Set to false for nodes with larger amount of channels. This modification leads to increased
# latency during initialization, yet significantly boosts runtime performance of the daemon.
sync-freelist=true
# Specify the maximum number of logfiles retained in rotation and the threshold size for rotation initiation.
maxlogfiles=5
maxlogfilesize=400
[Bitcoin]
bitcoin.active=1
bitcoin.${CHAIN}=1
@ -337,6 +344,7 @@ Description=Lightning Network Daemon on $CHAIN
# Make sure lnd starts after bitcoind is ready
Requires=${netprefix}bitcoind.service
After=${netprefix}bitcoind.service
PartOf=${netprefix}bitcoind.service
[Service]
EnvironmentFile=/mnt/hdd/raspiblitz.conf

View File

@ -1,49 +0,0 @@
#!/bin/bash
# based on: https://github.com/rootzoll/raspiblitz/issues/1000
if [ $# -eq 0 ]; then
echo "activate/deactivate LND keysend feature"
echo "lnd.keysend.sh [on|off|status]"
exit 1
fi
# note: this script is not run during provision/recovery
# because if the lnd extra parameter is set in raspiblitz.conf,
# it will automatically be used by the service
source /mnt/hdd/raspiblitz.conf
parameter=$1
if [ "${parameter}" == "on" ]; then
# store to raspiblitz config
/home/admin/config.scripts/blitz.conf.sh delete lndExtraParameter
/home/admin/config.scripts/blitz.conf.sh set lndKeysend "on"
echo "# OK - keysend feature is switched ON"
echo "# will be enfored by lnd.check.sh prestart"
echo "# LND or RaspiBlitz needs restart"
elif [ "${parameter}" == "off" ]; then
# just remove the parameter from the config file
/home/admin/config.scripts/blitz.conf.sh delete lndExtraParameter
/home/admin/config.scripts/blitz.conf.sh delete lndKeysend
sudo sed -i '/accept-keysend=.*/d' /mnt/hdd/lnd/lnd.conf 2>/dev/null
sudo sed -i '/accept-keysend=.*/d' /mnt/hdd/lnd/tlnd.conf 2>/dev/null
sudo sed -i '/accept-keysend=.*/d' /mnt/hdd/lnd/slnd.conf 2>/dev/null
echo "# OK - keysend enforcement is switched OFF"
echo "# LND or RaspiBlitz needs restart"
elif [ "${parameter}" == "status" ]; then
keysendOn=$(sudo cat /mnt/hdd/raspiblitz.conf | grep -c '^lndKeysend=on')
keysendRunning=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c '^accept-keysend\=true')
echo "keysendOn=${keysendOn}"
echo "keysendRunning=${keysendRunning}"
else
echo "err='unknown parameter'"
fi

View File

@ -0,0 +1,50 @@
#!/bin/bash
# This script allows users to sign a message from a specific Bitcoin address
# either by generating a new address or using an existing one.
# Ask if a new address should be generated or an existing one should be entered
read -p "Do you want to generate a new address? (y/n) " generate_new
# 1.a. If generating a new address, ask for the address type
if [ "$generate_new" == "y" ]; then
echo "Generate a wallet new address. Address-types has to be one of:"
echo "1. p2wkh: Pay to witness key hash"
echo "2. np2wkh: Pay to nested witness key hash"
echo "3. p2tr: Pay to taproot pubkey"
read -p "Enter the address type (1-3 or string): " address_type
case "$address_type" in
1|"p2wkh")
address_type="p2wkh"
;;
2|"np2wkh")
address_type="np2wkh"
;;
3|"p2tr")
address_type="p2tr"
;;
*)
echo "Error: Invalid address type."
exit 1
;;
esac
address=$(lncli newaddress $address_type)
address_variable=$(echo $address | jq -r '.address')
else
# 1.b. Check if the manually entered address is valid
read -p "Enter the existing address: " address
if ! bitcoin-cli validateaddress "$address" | grep -q "isvalid\": true"; then
echo "Error: The entered address is not valid."
exit 1
fi
address_variable=$address
fi
# 2. Ask for the message to sign and save it to a variable
read -p "Enter the message to sign: " message_to_sign
# 3. Execute the lncli wallet addresses signmessage command
signature_js=$(lncli wallet addresses signmessage --address $address_variable --msg "$message_to_sign")
signature=$(echo $signature_js | jq -r '.signature')
echo "The address is: $address_variable"
echo "The message to sign is: $message_to_sign"
echo "The signature is: $signature"

View File

@ -30,7 +30,14 @@ if [ "$1" = "status" ]; then
echo "##### STATUS TXINDEX"
indexByteSize=$(sudo du -s /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | cut -f1)
# check user is root
if [ "$EUID" -ne 0 ]; then
logger "FAIL: network.txindex.sh status needs sudo"
echo "error='missing sudo'"
exit 1
fi
indexByteSize=$(du -s /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | cut -f1)
if [ "${indexByteSize}" == "" ]; then
indexByteSize=0
fi
@ -44,8 +51,8 @@ if [ "$1" = "status" ]; then
# try to gather if still indexing
source <(/home/admin/_cache.sh get btc_mainnet_blocks_headers)
blockchainHeight="${btc_mainnet_blocks_headers}"
indexedToBlock=$(sudo tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep "Syncing txindex with block chain from height" | tail -n 1 | cut -d " " -f 9 | sed 's/[^0-9]*//g')
indexFinished=$(sudo tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep -c "txindex is enabled at height")
indexedToBlock=$(tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep "Syncing txindex with block chain from height" | tail -n 1 | cut -d " " -f 9 | sed 's/[^0-9]*//g')
indexFinished=$(tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep -c "txindex is enabled at height")
if [ ${#indexedToBlock} -eq 0 ] || [ ${indexFinished} -gt 0 ] || [ "${indexedToBlock}" = "${blockchainHeight}" ]; then
echo "isIndexed=1"

View File

@ -44,12 +44,17 @@ if [ "${btc_default_blocks_data_kb}" != "" ] && [ ${btc_default_blocks_data_kb}
OPTIONS=()
OPTIONS+=(SELFSYNC "Run full self sync/validation (takes long)")
OPTIONS+=(COPY "Copy from Computer/RaspiBlitz over LAN (3-10h)")
OPTIONS+=(TESTNET "Sync smaller Testnet (ONLY DEVELOPER)")
CHOICESUB=$(dialog --backtitle "RaspiBlitz" --clear --title " Blockchain Sync/Validation " --menu "\nYour Blockchain is not fully synced yet.\nThe full validation might take multiple days to finish.\n\nHow do you want to proceed:" 13 66 7 "${OPTIONS[@]}" 2>&1 >/dev/tty)
if [ "${CHOICESUB}" == "COPY" ]; then
/home/admin/config.scripts/blitz.copychain.sh target
fi
if [ "${CHOICESUB}" == "TESTNET" ]; then
sudo /home/admin/config.scripts/bitcoin.testnet.sh activate
fi
fi
############################################

View File

@ -28,7 +28,7 @@ actionString="Please wait - this can take some time"
# formatting BLOCKCHAIN SYNC PROGRESS
if [ "${btc_default_ready}" == "0" ] || [ "${btc_default_peers}" == "" ]; then
if [ ${system_count_start_blockchain} -gt 1 ]; then
if [ "${system_count_start_blockchain}" != "" ] && [ ${system_count_start_blockchain} -gt 1 ]; then
syncProgress="${system_count_start_blockchain} restarts"
else
syncProgress="waiting for start"

View File

@ -147,12 +147,6 @@ ssh admin@${internet_localip}
Use your Password A
" 7 41
elif [ "${eventID}" == "copystation" ] && [ "${mode}" == "lcd" ]; then
dialog --backtitle "${backtitle}" --title " Copy-Station Mode " --cr-wrap --infobox "
${contentString}" 7 41
elif [ "${eventID}" == "walletlocked" ] && [ "${mode}" == "lcd" ]; then
dialog --backtitle "${backtitle}" --cr-wrap --infobox "