mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-17 13:21:44 +01:00
Merge branch 'dev' into elements
This commit is contained in:
commit
0e5ed29dd4
@ -90,7 +90,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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
@ -310,9 +307,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
|
||||
;;
|
||||
|
@ -98,8 +98,7 @@ do
|
||||
network \
|
||||
chain \
|
||||
lightning \
|
||||
internet_localip \
|
||||
system_vm_vagrant \
|
||||
internet_localip
|
||||
)
|
||||
|
||||
# background.scan is not ready yet
|
||||
@ -281,25 +280,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
|
||||
|
@ -26,7 +26,6 @@ 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
|
||||
@ -66,7 +65,6 @@ if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||
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
|
||||
|
||||
@ -485,23 +483,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
|
||||
|
@ -490,9 +490,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")
|
||||
|
@ -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)"
|
||||
@ -171,9 +157,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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -721,15 +721,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}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -148,7 +148,12 @@ 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=$(sudo du -s /mnt/hdd/bitcoin/${subfolder}blocks 2>/dev/null | cut -f1)
|
||||
if [ "${btc_blocks_data_kb}" == "" ]; then
|
||||
btc_blocks_data_kb="0"
|
||||
fi
|
||||
|
||||
# print data
|
||||
|
||||
# parse data
|
||||
btc_blocks_headers=$(echo "${blockchaininfo}" | jq -r '.headers')
|
||||
@ -156,9 +161,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
|
||||
|
80
home.admin/config.scripts/bitcoin.testnet.sh
Executable file
80
home.admin/config.scripts/bitcoin.testnet.sh
Executable 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
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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:
|
||||
|
@ -268,8 +268,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)
|
||||
|
||||
|
162
home.admin/config.scripts/blitz.vm.sh
Executable file
162
home.admin/config.scripts/blitz.vm.sh
Executable 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
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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 ""
|
||||
|
||||
|
@ -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,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
[Unit]
|
||||
Description=lnbits
|
||||
Wants=bitcoind.service
|
||||
After=bitcoind.service
|
||||
Wants=${systemdDependency}
|
||||
After=${systemdDependency}
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/home/lnbits/lnbits
|
||||
@ -842,13 +851,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 +933,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 +1019,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 +1082,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 +1204,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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
50
home.admin/config.scripts/lnd.signaddress.sh
Normal file
50
home.admin/config.scripts/lnd.signaddress.sh
Normal 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"
|
@ -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
|
||||
|
||||
############################################
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user