mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-17 13:21:44 +01:00
commit
d158345bab
@ -3,7 +3,7 @@
|
||||
- Update: RaspiOS base image from 2023-05-03
|
||||
- Update: Bitcoin Core v25.0.0 [details](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-25.0.md)
|
||||
- Update: LND v0.16.4-beta [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.16.4-beta)
|
||||
- Update: Core Lightning v23.05.2 [details](https://github.com/ElementsProject/lightning/releases/tag/v23.05.2)
|
||||
- Update: Core Lightning v23.08 [details](https://github.com/ElementsProject/lightning/releases/tag/v23.08)
|
||||
- Update: Suez - Channel Visualization for LND & CLN [details](https://github.com/prusnak/suez)
|
||||
- Update: Electrum Server in Rust (electrs) v0.10.0 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#0100-jul-22-2023)
|
||||
- Update: C-lightningREST v0.10.5 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.10.5)
|
||||
@ -17,6 +17,7 @@
|
||||
- Update: Specter Desktop 1.13.1 [details](https://github.com/cryptoadvance/specter-desktop/releases/tag/v1.13.1)
|
||||
- Update: Kindle-Display 0.5.1 [details](https://github.com/dennisreimann/kindle-display/)
|
||||
- Fix: Homebanking Interface FinTS/HBCI (experimental) [details](https://github.com/rootzoll/raspiblitz/issues/1186)
|
||||
- Remove: Spark Wallet and Sparko CLN plugin (not maintained anymore)
|
||||
|
||||
## What's new in Version 1.9.0 of RaspiBlitz?
|
||||
|
||||
|
@ -89,12 +89,6 @@ fi
|
||||
if [ "${lndg}" == "on" ]; then
|
||||
OPTIONS+=(LNDG "LNDg (auto-rebalance, auto-fees)")
|
||||
fi
|
||||
if [ "${sparko}" == "on" ]; then
|
||||
OPTIONS+=(SPARKO "Sparko Webwallet")
|
||||
fi
|
||||
if [ "${spark}" == "on" ]; then
|
||||
OPTIONS+=(SPARK "Spark Wallet")
|
||||
fi
|
||||
if [ "${ElectRS}" == "on" ]; then
|
||||
OPTIONS+=(ELECTRS "Electrum Rust Server")
|
||||
fi
|
||||
@ -278,12 +272,6 @@ case $CHOICE in
|
||||
LNDG)
|
||||
/home/admin/config.scripts/bonus.lndg.sh menu
|
||||
;;
|
||||
SPARKO)
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh menu mainnet
|
||||
;;
|
||||
SPARK)
|
||||
/home/admin/config.scripts/cl.spark.sh menu mainnet
|
||||
;;
|
||||
LNBITS)
|
||||
/home/admin/config.scripts/bonus.lnbits.sh menu
|
||||
;;
|
||||
|
@ -13,8 +13,6 @@ if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
|
||||
if [ ${#lnd} -eq 0 ]; then lnd="off"; fi
|
||||
if [ ${#cl} -eq 0 ]; then cl="off"; fi
|
||||
if [ ${#crtlWebinterface} -eq 0 ]; then crtlWebinterface="off"; fi
|
||||
if [ ${#sparko} -eq 0 ]; then sparko="off"; fi
|
||||
if [ ${#spark} -eq 0 ]; then spark="off"; fi
|
||||
|
||||
# show select dialog
|
||||
echo "run dialog ..."
|
||||
@ -24,8 +22,6 @@ OPTIONS+=(l "LND on $CHAIN" ${lnd})
|
||||
OPTIONS+=(r "RTL for LND $CHAIN" ${rtlWebinterface})
|
||||
OPTIONS+=(c "Core Lightning on $CHAIN" ${cl})
|
||||
OPTIONS+=(t "RTL for CL on $CHAIN" ${crtlWebinterface})
|
||||
OPTIONS+=(s "Sparko for CL on $CHAIN" ${sparko})
|
||||
OPTIONS+=(m "Spark for CL on $CHAIN" ${spark})
|
||||
|
||||
CHOICES=$(dialog --title ' Additional Services ' \
|
||||
--checklist ' use spacebar to activate/de-activate ' \
|
||||
@ -145,50 +141,6 @@ else
|
||||
echo "RTL for CL $CHAIN Setting unchanged."
|
||||
fi
|
||||
|
||||
# sparko process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${sparko}" != "${choice}" ]; then
|
||||
echo "# Sparko on $CHAIN Setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh ${choice} $CHAIN
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh menu $CHAIN
|
||||
else
|
||||
l1="# FAIL on Sparko on $CHAIN install #"
|
||||
l2="# Try manual install on terminal after reboot with:"
|
||||
l3="/home/admin/config.scripts/cl-plugin.sparko.sh on $CHAIN"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "# Sparko on $CHAIN Setting unchanged."
|
||||
fi
|
||||
|
||||
# spark process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "m")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${spark}" != "${choice}" ]; then
|
||||
echo "# Spark Wallet on $CHAIN Setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/cl.spark.sh ${choice} $CHAIN
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
/home/admin/config.scripts/cl.spark.sh menu $CHAIN
|
||||
else
|
||||
l1="# FAIL on Spark Wallet on $CHAIN install #"
|
||||
l2="# Try manual install on terminal after reboot with:"
|
||||
l3="/home/admin/config.scripts/cl.spark.sh on $CHAIN"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "# Spark Wallet on $CHAIN Setting unchanged."
|
||||
fi
|
||||
|
||||
if [ ${anychange} -eq 0 ]; then
|
||||
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
|
||||
exit 0
|
||||
|
@ -13,8 +13,6 @@ if [ ${#trtlWebinterface} -eq 0 ]; then trtlWebinterface="off"; fi
|
||||
if [ ${#tlnd} -eq 0 ]; then tlnd="off"; fi
|
||||
if [ ${#tcrtlWebinterface} -eq 0 ]; then tcrtlWebinterface="off"; fi
|
||||
if [ ${#tcl} -eq 0 ]; then tcl="off"; fi
|
||||
if [ ${#tsparko} -eq 0 ]; then tsparko="off"; fi
|
||||
if [ ${#tspark} -eq 0 ]; then tspark="off"; fi
|
||||
|
||||
# show select dialog
|
||||
echo "run dialog ..."
|
||||
@ -24,8 +22,6 @@ OPTIONS+=(l "LND on $CHAIN" ${tlnd})
|
||||
OPTIONS+=(r "RTL for LND $CHAIN" ${trtlWebinterface})
|
||||
OPTIONS+=(c "Core Lightning on $CHAIN" ${tcl})
|
||||
OPTIONS+=(t "RTL for CL on $CHAIN" ${tcrtlWebinterface})
|
||||
OPTIONS+=(s "Sparko for CL on $CHAIN" ${tsparko})
|
||||
OPTIONS+=(m "Spark Wallet fro CL on $CHAIN" ${tspark})
|
||||
|
||||
CHOICES=$(dialog --title ' Additional Services ' \
|
||||
--checklist ' use spacebar to activate/de-activate ' \
|
||||
@ -142,50 +138,6 @@ else
|
||||
echo "RTL for CL $CHAIN Setting unchanged."
|
||||
fi
|
||||
|
||||
# tsparko process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${tsparko}" != "${choice}" ]; then
|
||||
echo "# Sparko on $CHAIN Setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh ${choice} $CHAIN
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh menu $CHAIN
|
||||
else
|
||||
l1="# FAIL on Sparko on $CHAIN install #"
|
||||
l2="# Try manual install on terminal after reboot with:"
|
||||
l3="/home/admin/config.scripts/cl-plugin.sparko.sh on $CHAIN"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "# Sparko on $CHAIN Setting unchanged."
|
||||
fi
|
||||
|
||||
# tspark process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "m")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${tspark}" != "${choice}" ]; then
|
||||
echo "# Spark Wallet on $CHAIN Setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/cl.spark.sh ${choice} $CHAIN
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
/home/admin/config.scripts/cl.spark.sh menu $CHAIN
|
||||
else
|
||||
l1="# FAIL on Spark Wallet on $CHAIN install #"
|
||||
l2="# Try manual install on terminal after reboot with:"
|
||||
l3="/home/admin/config.scripts/cl.spark.sh on $CHAIN"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "# Spark Wallet on $CHAIN Setting unchanged."
|
||||
fi
|
||||
|
||||
if [ ${anychange} -eq 0 ]; then
|
||||
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
|
||||
exit 0
|
||||
|
@ -28,8 +28,6 @@ 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 [ ${#homer} -eq 0 ]; then homer="off"; fi
|
||||
if [ ${#sparko} -eq 0 ]; then sparko="off"; fi
|
||||
if [ ${#spark} -eq 0 ]; then spark="off"; fi
|
||||
if [ ${#tallycoinConnect} -eq 0 ]; then tallycoinConnect="off"; fi
|
||||
if [ ${#helipad} -eq 0 ]; then helipad="off"; fi
|
||||
if [ ${#bitcoinminds} -eq 0 ]; then bitcoinminds="off"; fi
|
||||
@ -82,8 +80,6 @@ fi
|
||||
# just available for CL
|
||||
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||
OPTIONS+=(ca 'Core Lightning RTL Webinterface' ${crtlWebinterface})
|
||||
OPTIONS+=(ka 'Core Lightning Sparko WebWallet' ${sparko})
|
||||
OPTIONS+=(na 'Core Lightning Spark Wallet' ${spark})
|
||||
fi
|
||||
|
||||
OPTIONS+=(ma 'Homer Dashboard' ${homer})
|
||||
@ -662,50 +658,6 @@ else
|
||||
echo "BitcoinMinds setting unchanged."
|
||||
fi
|
||||
|
||||
# sparko process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "ka")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${sparko}" != "${choice}" ]; then
|
||||
echo "# Sparko on mainnet Setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh ${choice} mainnet
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh menu mainnet
|
||||
else
|
||||
l1="# FAIL on Sparko on mainnet install #"
|
||||
l2="# Try manual install on terminal after reboot with:"
|
||||
l3="/home/admin/config.scripts/cl-plugin.sparko.sh on mainnet"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "# Sparko on mainnet Setting unchanged."
|
||||
fi
|
||||
|
||||
# spark wallet process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "na")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${spark}" != "${choice}" ]; then
|
||||
echo "# Spark Wallet on mainnet Setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/cl.spark.sh ${choice} mainnet
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
/home/admin/config.scripts/cl.spark.sh menu mainnet
|
||||
else
|
||||
l1="# FAIL on Spark Wallet on mainnet install #"
|
||||
l2="# Try manual install on terminal after reboot with:"
|
||||
l3="/home/admin/config.scripts/cl.spark.sh on mainnet"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "# Spark Wallet on mainnet Setting unchanged."
|
||||
fi
|
||||
|
||||
# squeaknode process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "qa")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
|
@ -81,8 +81,6 @@ fi
|
||||
|
||||
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||
OPTIONS+=(ZEUS_CLREST "Zeus to Core LightningREST (Android or iOS)")
|
||||
OPTIONS+=(ZEUS_SPARK "Zeus to Sparko (Android or iOS)")
|
||||
OPTIONS+=(SPARK "Spark Wallet to Sparko (Android - EXPERIMENTAL)" )
|
||||
OPTIONS+=(FULLYNODED_CL "Fully Noded to CL REST (iOS+Tor)")
|
||||
fi
|
||||
|
||||
@ -283,37 +281,4 @@ ZEUS_CLREST)
|
||||
/home/admin/config.scripts/cl.rest.sh connect
|
||||
exit 0;
|
||||
;;
|
||||
ZEUS_SPARK)
|
||||
sudo /home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
|
||||
whiptail --title "Install Zeus on your Android or iOS Phone" \
|
||||
--yes-button "Continue" \
|
||||
--no-button "Cancel" \
|
||||
--yesno "Open the https://zeusln.app/ on your mobile phone to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
|
||||
if [ $? -eq 1 ]; then
|
||||
exit 0
|
||||
fi
|
||||
sudo /home/admin/config.scripts/blitz.display.sh hide
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh connect
|
||||
exit 0;
|
||||
;;
|
||||
SPARK)
|
||||
appstoreLink="https://github.com/shesek/spark-wallet#mobile-app"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
|
||||
whiptail --title "Install Zeus on your Android Phone" \
|
||||
--yes-button "Continue" \
|
||||
--no-button "GitHub link" \
|
||||
--yesno "Open the ${appstoreLink} on Android to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
|
||||
if [ $? -eq 1 ]; then
|
||||
sudo /home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
||||
whiptail --title " GitHub link " --msgbox "\
|
||||
To install app open the following link:\n
|
||||
${appstoreLink}\n
|
||||
Or scan the QR code on the LCD with your mobile phone.
|
||||
" 11 70
|
||||
fi
|
||||
sudo /home/admin/config.scripts/blitz.display.sh hide
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh connect
|
||||
exit 0;
|
||||
;;
|
||||
|
||||
esac
|
||||
|
@ -13,7 +13,7 @@ if [ "$1" == "only-one-loop" ]; then
|
||||
fi
|
||||
# start with parameter "install" (to setup service as systemd background running)
|
||||
if [ "$1" == "install" ]; then
|
||||
|
||||
|
||||
# write systemd service
|
||||
cat > /etc/systemd/system/background.scan.service <<EOF
|
||||
# Monitor the RaspiBlitz State
|
||||
@ -56,7 +56,7 @@ configFile="/mnt/hdd/raspiblitz.conf"
|
||||
# INFOFILE - persited state data
|
||||
infoFile="/home/admin/raspiblitz.info"
|
||||
|
||||
# better readbale seconds (slightly off to reduce same time window trigger)
|
||||
# better readable seconds (slightly off to reduce same time window trigger)
|
||||
MINUTE=60
|
||||
MINUTE2=115
|
||||
MINUTE5=290
|
||||
@ -74,21 +74,21 @@ YEAR=31536000
|
||||
usermod -G bitcoin root
|
||||
|
||||
####################################################################
|
||||
# INIT
|
||||
# INIT
|
||||
####################################################################
|
||||
|
||||
# init values
|
||||
/home/admin/_cache.sh set system_temp_celsius "0"
|
||||
/home/admin/_cache.sh set system_temp_fahrenheit "0"
|
||||
/home/admin/_cache.sh set system_count_longscan "0"
|
||||
/home/admin/_cache.sh set system_count_undervoltage "0"
|
||||
/home/admin/_cache.sh set system_count_start_blockchain "0"
|
||||
/home/admin/_cache.sh set system_count_start_lightning "0"
|
||||
/home/admin/_cache.sh set system_count_start_tui "0"
|
||||
/home/admin/_cache.sh set btc_default_peers "0"
|
||||
/home/admin/_cache.sh set btc_default_sync_percentage "0"
|
||||
/home/admin/_cache.sh set btc_default_address ""
|
||||
/home/admin/_cache.sh set btc_default_port ""
|
||||
/home/admin/_cache.sh init system_temp_celsius "0"
|
||||
/home/admin/_cache.sh init system_temp_fahrenheit "0"
|
||||
/home/admin/_cache.sh init system_count_longscan "0"
|
||||
/home/admin/_cache.sh init system_count_undervoltage "0"
|
||||
/home/admin/_cache.sh init system_count_start_blockchain "0"
|
||||
/home/admin/_cache.sh init system_count_start_lightning "0"
|
||||
/home/admin/_cache.sh init system_count_start_tui "0"
|
||||
/home/admin/_cache.sh init btc_default_peers "0"
|
||||
/home/admin/_cache.sh init btc_default_sync_percentage "0"
|
||||
/home/admin/_cache.sh init btc_default_address ""
|
||||
/home/admin/_cache.sh init btc_default_port ""
|
||||
|
||||
# import all base values from raspiblitz.info
|
||||
echo "importing: ${infoFile}"
|
||||
@ -132,8 +132,8 @@ while [ 1 ]
|
||||
do
|
||||
|
||||
####################################################################
|
||||
# LOOP DATA (BASIC SYSTEM)
|
||||
# data that is always available
|
||||
# LOOP DATA (BASIC SYSTEM)
|
||||
# data that is always available
|
||||
####################################################################
|
||||
|
||||
# check that redis contains init data (detect possible restart of redis)
|
||||
@ -147,7 +147,7 @@ do
|
||||
startTime=$(date +%s)
|
||||
|
||||
#################
|
||||
# BASIC SYSTEM
|
||||
# BASIC SYSTEM
|
||||
|
||||
# uptime just do on every run
|
||||
system_up=$(cat /proc/uptime | grep -o '^[0-9]\+')
|
||||
@ -396,7 +396,7 @@ do
|
||||
|
||||
# update detail infos only when ready (get as value from cache)
|
||||
source <(/home/admin/_cache.sh meta btc_${CHAIN}net_ready)
|
||||
if [ "${value}" == "1" ]; then
|
||||
if [ "${value}" == "1" ]; then
|
||||
|
||||
# check if network needs update
|
||||
source <(/home/admin/_cache.sh valid \
|
||||
@ -432,7 +432,7 @@ do
|
||||
/home/admin/_cache.sh set btc_${CHAIN}net_sync_progress "${btc_sync_progress}"
|
||||
/home/admin/_cache.sh set btc_${CHAIN}net_sync_percentage "${btc_sync_percentage}"
|
||||
/home/admin/_cache.sh set btc_${CHAIN}net_sync_initialblockdownload "${btc_sync_initialblockdownload}"
|
||||
|
||||
|
||||
if [ "${isDefaultChain}" == "1" ]; then
|
||||
/home/admin/_cache.sh set btc_default_synced "${btc_synced}"
|
||||
/home/admin/_cache.sh set btc_default_blocks_headers "${btc_blocks_headers}"
|
||||
@ -1044,7 +1044,7 @@ do
|
||||
# if was started with special parameter
|
||||
if [ "${ONLY_ONE_LOOP}" == "1" ]; then
|
||||
echo "Exiting because ONLY_ONE_LOOP==1"
|
||||
exit 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
done
|
||||
|
@ -5,7 +5,7 @@
|
||||
# 2) KEY-VALUE STORE for system state infos (REDIS)
|
||||
|
||||
# SECURITY NOTE: The files on the RAMDISK can be set with unix file permissions and so restrict certain users access.
|
||||
# But all data stored in the KEY-VALUE STORE has to be asumed as system-wide public information.
|
||||
# But all data stored in the KEY-VALUE STORE has to be assumed as system-wide public information.
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ]; then
|
||||
@ -14,28 +14,29 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ];
|
||||
echo "_cache.sh ramdisk [on|off]"
|
||||
echo "_cache.sh keyvalue [on|off]"
|
||||
echo
|
||||
echo "_cache.sh init [key] [value] (only sets value if not exists)"
|
||||
echo "_cache.sh set [key] [value] [?expire-seconds]"
|
||||
echo "_cache.sh get [key1] [?key2] [?key3] ..."
|
||||
echo
|
||||
echo
|
||||
echo "_cache.sh increment [key1]"
|
||||
echo
|
||||
echo "_cache.sh focus [key] [update-seconds] [?duration-seconds]"
|
||||
echo "# set in how many seconds value is marked to be rescanned"
|
||||
echo "# -1 = slowest default update cycle"
|
||||
echo "# -1 = slowest default update cycle"
|
||||
echo "# 0 = update on every cycle"
|
||||
echo "# set a 'duration-seconds' after defaults to -1 (optional)"
|
||||
echo
|
||||
echo
|
||||
echo "_cache.sh meta [key] [?default]"
|
||||
echo "# get single key with additional metadata:"
|
||||
echo "# updateseconds= see above"
|
||||
echo "# stillvalid=0/1 if value is still valid or outdated"
|
||||
echo "# lasttouch= last update timestamp in unix seconds"
|
||||
echo
|
||||
echo
|
||||
echo "_cache.sh valid [key1] [?key2] [?key3] ..."
|
||||
echo "# check multiple keys if all are still not outdated"
|
||||
echo "# use for example to check if a complex call needs"
|
||||
echo "# to be made that covers multiple single data points"
|
||||
echo
|
||||
echo
|
||||
echo "_cache.sh import [bash-keyvalue-file]"
|
||||
echo "# import a bash style key-value file into store"
|
||||
echo
|
||||
@ -46,7 +47,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ];
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# BACKGROUND: we need to build outdated meta info manually,
|
||||
# BACKGROUND: we need to build outdated meta info manually,
|
||||
# because there is nothing as "AGE" in redis: https://github.com/redis/redis/issues/1147
|
||||
# only feature that can be used uis the EXPIRE feature to determine if a value is still valid
|
||||
|
||||
@ -55,7 +56,7 @@ META_OUTDATED_SECONDS=":out"
|
||||
META_LASTTOUCH_TS=":ts"
|
||||
META_VALID_FLAG=":val"
|
||||
|
||||
# path of the raspiblitz.info file (persiting cache values)
|
||||
# path of the raspiblitz.info file (persisting cache values)
|
||||
infoFile="/home/admin/raspiblitz.info"
|
||||
|
||||
###################
|
||||
@ -133,44 +134,50 @@ elif [ "$1" = "keyvalue" ] && [ "$2" = "off" ]; then
|
||||
###################
|
||||
|
||||
# set
|
||||
elif [ "$1" = "set" ]; then
|
||||
elif [ "$1" = "set" ] || [ "$1" = "init" ]; then
|
||||
|
||||
# get parameters
|
||||
keystr=$2
|
||||
valuestr=$3
|
||||
expire=$4
|
||||
|
||||
# check that key & value are given
|
||||
# check that key & value are provided
|
||||
if [ "${keystr}" == "" ]; then
|
||||
echo "# Fail: missing parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
NX=""
|
||||
if [ "$1" = "init" ]; then
|
||||
NX="NX "
|
||||
fi
|
||||
|
||||
# filter from expire just numbers
|
||||
expire="${expire//[^0-9.]/}"
|
||||
|
||||
# add an expire flag if given
|
||||
additionalParams=""
|
||||
# add an expire flag if given
|
||||
if [ "${expire}" != "" ]; then
|
||||
additionalParams="EX ${expire}"
|
||||
fi
|
||||
|
||||
# set in redis key value cache
|
||||
redis-cli set ${keystr} "${valuestr}" ${additionalParams} 1>/dev/null
|
||||
redis-cli set ${NX} ${keystr} "${valuestr}" ${additionalParams} 1>/dev/null
|
||||
|
||||
# set in redis the timestamp
|
||||
timestamp=$(date +%s)
|
||||
redis-cli set ${keystr}${META_LASTTOUCH_TS} "${timestamp}" ${additionalParams} 1>/dev/null
|
||||
redis-cli set ${NX}${keystr}${META_LASTTOUCH_TS} "${timestamp}" ${additionalParams} 1>/dev/null
|
||||
#echo "# lasttouch(${timestamp})"
|
||||
|
||||
# check if the value has a outdate policy
|
||||
outdatesecs=$(redis-cli get ${keystr}${META_OUTDATED_SECONDS})
|
||||
if [ "${outdatesecs}" == "" ]; then
|
||||
outdatesecs="-1"
|
||||
fi
|
||||
fi
|
||||
#echo "# outdatesecs(${outdatesecs})"
|
||||
if [ "${outdatesecs}" != "-1" ]; then
|
||||
# set exipire valid flag (if its gone - value is considered as outdated)
|
||||
# set expire valid flag (if its gone - value is considered as outdated)
|
||||
redis-cli set ${keystr}${META_VALID_FLAG} "1" EX ${outdatesecs} 1>/dev/null
|
||||
fi
|
||||
|
||||
@ -186,7 +193,7 @@ elif [ "$1" = "get" ]; then
|
||||
position=0
|
||||
for keystr in $@
|
||||
do
|
||||
|
||||
|
||||
# skip first parameter
|
||||
((position++))
|
||||
if [ $position -eq 1 ]; then
|
||||
@ -243,7 +250,7 @@ elif [ "$1" = "export" ]; then
|
||||
# get parameter
|
||||
keyfilter="${2}*"
|
||||
|
||||
# go thru all keys by keyfilter
|
||||
# go through all keys by keyfilter
|
||||
keylist=$(redis-cli KEYS "${keyfilter}")
|
||||
readarray -t arr <<< "${keylist}"
|
||||
for key in "${arr[@]}";do
|
||||
@ -266,7 +273,7 @@ elif [ "$1" = "export" ]; then
|
||||
|
||||
##################################
|
||||
# COUNT
|
||||
# count value up
|
||||
# increment value
|
||||
##################################
|
||||
|
||||
# set
|
||||
@ -309,7 +316,7 @@ elif [ "$1" = "focus" ]; then
|
||||
for key in "${arr[@]}";do
|
||||
if [ "${key}" == "" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
keyClean=$(echo $key | cut -d ":" -f1)
|
||||
value=$(redis-cli get "${key}")
|
||||
echo "${keyClean}=${value}"
|
||||
@ -324,7 +331,7 @@ elif [ "$1" = "focus" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# sanatize parameters (if not -1)
|
||||
# sanitize parameters (if not -1)
|
||||
outdatesecs="${outdatesecs//[^0-9.]/}"
|
||||
|
||||
# check that key & value are given
|
||||
@ -333,7 +340,7 @@ elif [ "$1" = "focus" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# add an expire flag if given
|
||||
# add an expire flag if given
|
||||
additionalParams=""
|
||||
if [ "${durationsecs//[^0-9.]/}" != "" ]; then
|
||||
additionalParams="EX ${durationsecs//[^0-9.]/}"
|
||||
@ -358,13 +365,13 @@ elif [ "$1" = "meta" ]; then
|
||||
keystr=$2
|
||||
default=$3
|
||||
|
||||
# check that key & value are given
|
||||
# check that key & value are provided
|
||||
if [ "${keystr}" == "" ]; then
|
||||
echo "# Fail: missing parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get redis basic value
|
||||
|
||||
# get redis basic value
|
||||
valuestr=$(redis-cli get ${keystr})
|
||||
echo "value=\"${valuestr}\""
|
||||
|
||||
@ -380,7 +387,7 @@ elif [ "$1" = "meta" ]; then
|
||||
# get META_OUTDATED_SECONDS
|
||||
outdatesecs=$(redis-cli get ${keystr}${META_OUTDATED_SECONDS})
|
||||
if [ "${outdatesecs}" == "" ]; then
|
||||
# default is -1 --> never outdate
|
||||
# default is -1 --> never outdate
|
||||
outdatesecs="-1"
|
||||
fi
|
||||
echo "outdatesecs=\"${outdatesecs}\""
|
||||
@ -406,7 +413,7 @@ elif [ "$1" = "valid" ]; then
|
||||
lasttouch_overall=""
|
||||
for keystr in $@
|
||||
do
|
||||
|
||||
|
||||
# skip first parameter from script - thats the action string
|
||||
((position++))
|
||||
if [ $position -eq 1 ]; then
|
||||
@ -436,7 +443,7 @@ elif [ "$1" = "valid" ]; then
|
||||
# get outdate police of value (outdated = not valid anymore)
|
||||
outdatesecs=$(redis-cli get ${keystr}${META_OUTDATED_SECONDS})
|
||||
#echo "# ${keystr}${META_OUTDATED_SECONDS}=\"${outdatesecs}\""
|
||||
|
||||
|
||||
# if outdate policy is default or -1 ==> never outdated
|
||||
if [ "${outdatesecs}" == "" ] || [ "${outdatesecs}" == "-1" ]; then
|
||||
continue
|
||||
@ -453,7 +460,7 @@ elif [ "$1" = "valid" ]; then
|
||||
|
||||
# so valid flag does not exists anymore
|
||||
# ==> this means value is outdated
|
||||
# break loop and
|
||||
# break loop and
|
||||
echo "stillvalid=\"0\""
|
||||
exit 0
|
||||
|
||||
|
@ -55,6 +55,8 @@ fi
|
||||
# make sure for the rest of the setup info is set correctly
|
||||
/home/admin/config.scripts/blitz.conf.sh set network "bitcoin"
|
||||
/home/admin/config.scripts/blitz.conf.sh set chain "main"
|
||||
echo "Provisioning ${network} Mainnet - run config script" >> ${logFile}
|
||||
/home/admin/config.scripts/bitcoin.install.sh on mainnet >> ${logFile} 2>&1
|
||||
|
||||
# set Password B
|
||||
echo "## SETTING PASSWORD B" >> ${logFile}
|
||||
|
@ -1,14 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# check if run by root user
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "error='run as root'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# This script gets called from a fresh SD card
|
||||
# starting up that has an config file on HDD
|
||||
# from old RaspiBlitz or manufacturer to
|
||||
# starting up that has a config file on HDD
|
||||
# from old RaspiBlitz or manufacturer
|
||||
# to install and config services
|
||||
|
||||
# LOGFILE - store debug logs of bootstrap
|
||||
@ -72,7 +72,7 @@ if [ ${kbSizeRAM} -gt 3500000 ]; then
|
||||
fi
|
||||
|
||||
# zram on for all devices
|
||||
/home/admin/config.scripts/blitz.zram.sh on
|
||||
/home/admin/config.scripts/blitz.zram.sh on >> ${logFile}
|
||||
|
||||
# link and copy HDD content into new OS on sd card
|
||||
echo "Copy HDD content for user admin" >> ${logFile}
|
||||
@ -267,7 +267,7 @@ fi
|
||||
|
||||
# LND binary install
|
||||
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ] || [ "${tlnd}" == "on" ] || [ "${slnd}" == "on" ]; then
|
||||
# if already installed by fatpack will skip
|
||||
# if already installed by fatpack will skip
|
||||
echo "Provisioning LND Binary - run config script" >> ${logFile}
|
||||
/home/admin/config.scripts/lnd.install.sh install >> ${logFile} 2>&1
|
||||
else
|
||||
@ -302,7 +302,7 @@ fi
|
||||
|
||||
# CORE LIGHTNING binary install
|
||||
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ] || [ "${tcl}" == "on" ] || [ "${scl}" == "on" ]; then
|
||||
# if already installed by fatpack will skip
|
||||
# if already installed by fatpack will skip
|
||||
echo "Provisioning Core Lightning Binary - run config script" >> ${logFile}
|
||||
/home/admin/config.scripts/cl.install.sh install >> ${logFile} 2>&1
|
||||
else
|
||||
@ -348,8 +348,8 @@ blitzApiInstalled=$(systemctl status blitzapi | grep -c "loaded")
|
||||
if [ "${blitzapi}" == "on" ] && [ $blitzApiInstalled -eq 0 ]; then
|
||||
echo "Provisioning BlitzAPI - run config script" >> ${logFile}
|
||||
/home/admin/_cache.sh set message "Setup BlitzAPI (takes time)"
|
||||
/home/admin/config.scripts/blitz.web.api.sh on DEFAULT >> ${logFile} 2>&1
|
||||
/home/admin/config.scripts/blitz.web.ui.sh on DEFAULT >> ${logFile} 2>&1
|
||||
/home/admin/config.scripts/blitz.web.api.sh on DEFAULT >> ${logFile} 2>&1
|
||||
/home/admin/config.scripts/blitz.web.ui.sh on DEFAULT >> ${logFile} 2>&1
|
||||
else
|
||||
echo "Provisioning BlitzAPI - keep default" >> ${logFile}
|
||||
fi
|
||||
@ -399,15 +399,6 @@ else
|
||||
echo "Provisioning RTL CL - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
# SPARKO
|
||||
if [ "${sparko}" = "on" ]; then
|
||||
echo "Provisioning Sparko - run config script" >> ${logFile}
|
||||
/home/admin/_cache.sh set message "Setup SPARKO"
|
||||
sudo -u admin /home/admin/config.scripts/cl-plugin.sparko.sh on mainnet >> ${logFile} 2>&1
|
||||
else
|
||||
echo "Provisioning Sparko - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
# clHTTPplugin
|
||||
if [ "${clHTTPplugin}" = "on" ]; then
|
||||
echo "Provisioning clHTTPplugin - run config script" >> ${logFile}
|
||||
@ -435,15 +426,6 @@ else
|
||||
echo "Provisioning clWatchtowerClient - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
# SPARK
|
||||
if [ "${spark}" = "on" ]; then
|
||||
echo "Provisioning Spark Wallet - run config script" >> ${logFile}
|
||||
/home/admin/_cache.sh set message "Setup SPARK WALLET"
|
||||
sudo -u admin /home/admin/config.scripts/cl.spark.sh on mainnet >> ${logFile} 2>&1
|
||||
else
|
||||
echo "Provisioning Spark Wallet - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
#LOOP - install only if LiT won't be installed
|
||||
if [ "${loop}" = "on" ] && [ "${lit}" != "on" ]; then
|
||||
echo "Provisioning Lightning Loop - run config script" >> ${logFile}
|
||||
@ -839,7 +821,7 @@ if [ -d "/var/cache/raspiblitz/tls_backup" ]; then
|
||||
cp /var/cache/raspiblitz/tls_backup/tls.cert /mnt/hdd/lnd/tls.cert >> ${logFile} 2>&1
|
||||
cp /var/cache/raspiblitz/tls_backup/tls.key /mnt/hdd/lnd/tls.key >> ${logFile} 2>&1
|
||||
chown -R bitcoin:bitcoin /mnt/hdd/lnd >> ${logFile} 2>&1
|
||||
echo "On next final restart admin creds will be updated by _boostrap.sh" >> ${logFile}
|
||||
echo "On next final restart admin creds will be updated by _bootstrap.sh" >> ${logFile}
|
||||
|
||||
echo "DONE" >> ${logFile}
|
||||
else
|
||||
@ -903,6 +885,7 @@ echo "Make sure main services are running .." >> ${logFile}
|
||||
systemctl start ${network}d
|
||||
if [ "${lightning}" == "lnd" ];then
|
||||
systemctl start lnd
|
||||
sleep 10
|
||||
# set password c if given in flag from migration prep
|
||||
passwordFlagExists=$(ls /mnt/hdd/passwordc.flag | grep -c "passwordc.flag")
|
||||
if [ "${passwordFlagExists}" == "1" ]; then
|
||||
|
@ -1,3 +1,3 @@
|
||||
# RaspiBlitz Version - always [major].[main].[sub] (sub can be a string like '2rc1')
|
||||
codeVersion="1.10.0rc3"
|
||||
codeVersion="1.10.0rc4"
|
||||
# keep last line with comment
|
@ -1577,9 +1577,9 @@ if [ "$1" = "swap" ]; then
|
||||
sed -i "s/^CONF_SWAPFILE=.*/CONF_SWAPFILE=\/mnt\/hdd\/swapfile/g" /etc/dphys-swapfile
|
||||
fi
|
||||
sed -i "s/^CONF_SWAPSIZE=/#CONF_SWAPSIZE=/g" /etc/dphys-swapfile
|
||||
sed -i "s/^#CONF_MAXSWAP=.*/CONF_MAXSWAP=3072/g" /etc/dphys-swapfile
|
||||
sed -i "s/^#CONF_MAXSWAP=.*/CONF_MAXSWAP=10240/g" /etc/dphys-swapfile
|
||||
>&2 echo "# Creating SWAP file .."
|
||||
dd if=/dev/zero of=$externalSwapPath count=3072 bs=1MiB 1>/dev/null
|
||||
dd if=/dev/zero of=$externalSwapPath count=10240 bs=1MiB 1>/dev/null
|
||||
chmod 0600 $externalSwapPath 1>/dev/null
|
||||
>&2 echo "# Activating new SWAP"
|
||||
mkswap $externalSwapPath
|
||||
|
@ -446,6 +446,11 @@ echo "*** NETWORK ***"
|
||||
sudo /home/admin/config.scripts/internet.sh status | grep 'network_device\|localip\|dhcp'
|
||||
echo
|
||||
|
||||
echo
|
||||
echo "*** ZRAM ***"
|
||||
sudo /home/admin/config.scripts/blitz.zram.sh status
|
||||
echo
|
||||
|
||||
echo "*** HARDWARE TEST RESULTS ***"
|
||||
source <(/home/admin/_cache.sh get system_count_undervoltage)
|
||||
showImproveInfo=0
|
||||
|
@ -37,7 +37,7 @@ elif [ "$1" = "http-on" ]; then
|
||||
|
||||
# install
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y nginx apache2-utils
|
||||
sudo apt-get install -y nginx-full apache2-utils
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "error='nginx install failed'"
|
||||
exit 1
|
||||
|
@ -3,36 +3,72 @@
|
||||
# using https://github.com/foundObjects/zram-swap
|
||||
VERSION="205ea1ec5b169f566e5e98ead794e9daf90cf245"
|
||||
|
||||
if [ "$1" = status ]; then
|
||||
|
||||
# check if file /home/admin/download/zram-swap/install.sh exists
|
||||
#echo "# https://github.com/foundObjects/zram-swap"
|
||||
if [ -f /home/admin/download/zram-swap/install.sh ]; then
|
||||
echo "downloaded=1"
|
||||
else
|
||||
echo "downloaded=0"
|
||||
fi
|
||||
|
||||
# check if service zram-swap is loaded/active
|
||||
#echo "# sudo systemctl status zram-swap"
|
||||
serviceLoaded=$(sudo systemctl status zram-swap 2>/dev/null | grep -c loaded)
|
||||
if [ ${serviceLoaded} -gt 0 ]; then
|
||||
echo "serviceLoaded=1"
|
||||
else
|
||||
echo "serviceLoaded=0"
|
||||
fi
|
||||
serviceActive=$(sudo systemctl status zram-swap 2>/dev/null | grep -c active)
|
||||
if [ ${serviceActive} -gt 0 ]; then
|
||||
echo "serviceActive=1"
|
||||
else
|
||||
echo "serviceActive=0"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "config script to install ZRAM"
|
||||
echo "blitz.zram.sh [on|off]"
|
||||
echo "blitz.zram.sh [on|off|status]"
|
||||
echo "using https://github.com/foundObjects/zram-swap"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "# mkdir /home/admin/download"
|
||||
mkdir /home/admin/download 2>/dev/null
|
||||
cd /home/admin/download || exit 1
|
||||
if [ ! -d zram-swap ]; then
|
||||
echo "# download script"
|
||||
sudo -u admin git clone https://github.com/foundObjects/zram-swap.git
|
||||
echo "# cd zram-swap"
|
||||
cd zram-swap || exit 1
|
||||
git reset --hard $VERSION || exit 1
|
||||
echo "# check version"
|
||||
sudo -u admin git reset --hard $VERSION || exit 1
|
||||
echo "# version OK"
|
||||
else
|
||||
echo "# script available"
|
||||
cd zram-swap || exit 1
|
||||
echo "# directory OK"
|
||||
fi
|
||||
|
||||
if [ "$1" = on ]; then
|
||||
echo "# install zram-swap"
|
||||
if [ $(sudo cat /proc/swaps | grep -c zram) -eq 0 ]; then
|
||||
# install zram to 1/2 of RAM, activate and prioritize
|
||||
sudo /home/admin/download/zram-swap/install.sh
|
||||
|
||||
# make better use of zram
|
||||
echo "\
|
||||
vm.vfs_cache_pressure=500
|
||||
vm.swappiness=100
|
||||
vm.dirty_background_ratio=1
|
||||
vm.dirty_ratio=50
|
||||
" | sudo tee -a /etc/sysctl.conf
|
||||
echo "# RaspiBlitz Edit: blitz.zram.sh" | sudo tee -a /etc/sysctl.conf
|
||||
echo "vm.vfs_cache_pressure=500" | sudo tee -a /etc/sysctl.conf
|
||||
echo "vm.swappiness=100" | sudo tee -a /etc/sysctl.conf
|
||||
echo "vm.dirty_background_ratio=1" | sudo tee -a /etc/sysctl.conf
|
||||
echo "vm.dirty_ratio=50" | sudo tee -a /etc/sysctl.conf
|
||||
|
||||
# apply
|
||||
sudo sysctl --system
|
||||
@ -47,6 +83,7 @@ vm.dirty_ratio=50
|
||||
fi
|
||||
|
||||
if [ "$1" = off ]; then
|
||||
echo "# deinstall zram-swap"
|
||||
sudo /home/admin/download/zram-swap/install.sh --uninstall
|
||||
sudo rm /etc/default/zram-swap
|
||||
sudo rm -rf /home/admin/download/zram-swap
|
||||
|
@ -319,7 +319,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
# https://github.com/romanz/electrs/blob/master/doc/usage.md#configuration-files-and-environment-variables
|
||||
sudo -u electrs mkdir /home/electrs/.electrs 2>/dev/null
|
||||
echo "\
|
||||
log_filters = \"INFO\"
|
||||
log_filters = \"WARN\"
|
||||
timestamp = true
|
||||
jsonrpc_import = true
|
||||
index-batch-size = 10
|
||||
@ -422,7 +422,6 @@ Type=simple
|
||||
TimeoutSec=60
|
||||
Restart=always
|
||||
RestartSec=60
|
||||
LogLevelMax=5
|
||||
|
||||
# Hardening measures
|
||||
PrivateTmp=true
|
||||
|
@ -10,7 +10,7 @@ CONFIG_FILE=$APP_DATA_DIR/.env
|
||||
APP_ROOT_DIR=$HOME_DIR/kindle-display
|
||||
APP_SERVER_DIR=$APP_ROOT_DIR/server
|
||||
CRON_FILE=$APP_SERVER_DIR/cron.sh
|
||||
APP_VERSION=0.5.1
|
||||
APP_VERSION=0.5.3
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://github.com/lnproxy/lnproxy/commits/main
|
||||
LNPROXYVERSION="7c8a14106b42cfd89471c1dc02d7baab1122dfa2"
|
||||
LNPROXYVERSION="c1031bbe507623f8f196ff83aa5ea504cca05143"
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
|
@ -2,28 +2,34 @@
|
||||
# https://github.com/ZmnSCPxj/clboss#operating
|
||||
|
||||
# https://github.com/ZmnSCPxj/clboss/releases
|
||||
CLBOSSVERSION="0.13A"
|
||||
# https://github.com/ZmnSCPxj/clboss/commits/master
|
||||
CLBOSSVERSION="ef5c41612da0d544b0ed1f3e986b4b07126723a1"
|
||||
|
||||
# command info
|
||||
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
|
||||
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo
|
||||
echo "Install or remove the CLBOSS Core Lightning plugin"
|
||||
echo "version: v${CLBOSSVERSION}"
|
||||
echo "Usage:"
|
||||
echo "cl-plugin.clboss.sh [on|off] [testnet|mainnet|signet]"
|
||||
echo "cl-plugin.clboss.sh [info]"
|
||||
echo "cl-plugin.clboss.sh [on|off] [mainnet|testnet] <latest>"
|
||||
echo "cl-plugin.clboss.sh info"
|
||||
echo "cl-plugin.clboss.sh update"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -gt 2 ] && [ $3 = latest ]; then
|
||||
CLBOSSVERSION=""
|
||||
fi
|
||||
|
||||
# source <(/home/admin/config.scripts/network.aliases.sh getvars cl <mainnet|testnet|signet>)
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
|
||||
|
||||
if [ "$1" = info ]; then
|
||||
whiptail --title " CLBOSS WARNING " \
|
||||
whiptail --title " CLBOSS WARNING " \
|
||||
--yes-button "Install" \
|
||||
--no-button "Cancel" \
|
||||
--yesno "
|
||||
--no-button "Cancel" \
|
||||
--yesno "
|
||||
The goal of CLBOSS is to make the node able to pay and receive payments
|
||||
on the lightning network reliably without needing active management.
|
||||
It is not a tool to run a profitable lightning node and it can lose some sats on fees.
|
||||
@ -40,35 +46,39 @@ https://github.com/ZmnSCPxj/clboss#operating
|
||||
" 0 0
|
||||
fi
|
||||
|
||||
function buildFromSource() {
|
||||
version=$1
|
||||
# dependencies
|
||||
sudo apt install -y build-essential pkg-config libev-dev \
|
||||
libcurl4-gnutls-dev libsqlite3-dev dnsutils
|
||||
sudo apt install -y git automake autoconf-archive libtool
|
||||
|
||||
if [ "$1" = on ];then
|
||||
|
||||
if [ ! -f /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}.tar.gz ];then
|
||||
|
||||
# download tarball
|
||||
sudo -u bitcoin wget \
|
||||
https://github.com/ZmnSCPxj/clboss/releases/download/${CLBOSSVERSION}/clboss-${CLBOSSVERSION}.tar.gz \
|
||||
-O /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}.tar.gz || exit 1
|
||||
# download
|
||||
cd /home/bitcoin/cl-plugins-available/ || exit 1
|
||||
sudo -u bitcoin git clone https://github.com/ZmnSCPxj/clboss
|
||||
cd clboss || exit 1
|
||||
if [[ -v version && -n "$version" ]]; then
|
||||
sudo -u bitcoin git reset --hard ${version}
|
||||
fi
|
||||
|
||||
if [ ! -f /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}/clboss ];then
|
||||
# dependencies
|
||||
sudo apt install -y build-essential pkg-config libev-dev \
|
||||
libcurl4-gnutls-dev libsqlite3-dev dnsutils
|
||||
# build
|
||||
sudo -u bitcoin autoreconf -i
|
||||
sudo -u bitcoin ./configure && sudo -u bitcoin make
|
||||
# sudo make install # optional - installs to /usr/local/bin/clboss
|
||||
}
|
||||
|
||||
if [ "$1" = on ]; then
|
||||
|
||||
if [ ! -f /home/bitcoin/cl-plugins-available/clboss/clboss ]; then
|
||||
|
||||
buildFromSource ${CLBOSSVERSION}
|
||||
|
||||
# install
|
||||
cd /home/bitcoin/cl-plugins-available/ || exit 1
|
||||
sudo -u bitcoin tar -xvf clboss-${CLBOSSVERSION}.tar.gz
|
||||
cd clboss-${CLBOSSVERSION} || exit 1
|
||||
sudo -u bitcoin ./configure && sudo -u bitcoin make
|
||||
# sudo make install # installs to /usr/local/bin/clboss
|
||||
fi
|
||||
|
||||
# symlink to enable
|
||||
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/clboss ];then
|
||||
sudo ln -s /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}/clboss \
|
||||
/home/bitcoin/${netprefix}cl-plugins-enabled
|
||||
fi
|
||||
# refresh symlink to enable
|
||||
sudo rm /home/bitcoin/${netprefix}cl-plugins-enabled/clboss 2>/dev/null
|
||||
sudo ln -s /home/bitcoin/cl-plugins-available/clboss/clboss \
|
||||
/home/bitcoin/${netprefix}cl-plugins-enabled/
|
||||
|
||||
# setting value in raspiblitz.conf
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clboss "on"
|
||||
@ -85,17 +95,18 @@ if [ "$1" = on ];then
|
||||
echo "${netprefix}cl clboss-status"
|
||||
echo "https://github.com/ZmnSCPxj/clboss#operating"
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = off ];then
|
||||
if [ "$1" = off ]; then
|
||||
# delete symlink
|
||||
sudo rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/clboss
|
||||
|
||||
echo "# Restart the ${netprefix}lightningd.service to deactivate clboss"
|
||||
echo "# Restarting the ${netprefix}lightningd.service to deactivate clboss"
|
||||
sudo systemctl restart ${netprefix}lightningd
|
||||
|
||||
# purge
|
||||
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
|
||||
if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then
|
||||
echo "# Delete plugin"
|
||||
sudo rm -rf /home/bitcoin/cl-plugins-available/clboss*
|
||||
sudo rm -f /usr/local/bin/clboss
|
||||
@ -105,4 +116,25 @@ if [ "$1" = off ];then
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clboss "off"
|
||||
echo "# clboss was uninstalled for $CHAIN"
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = update ]; then
|
||||
if [ ! -f /home/bitcoin/cl-plugins-available/clboss/clboss ]; then
|
||||
/home/admin/config.scrips/cl-plugin/clboss.sh on "${CHAIN}"
|
||||
exit 0
|
||||
else
|
||||
sudo rm -rf /home/bitcoin/cl-plugins-available/clboss
|
||||
|
||||
buildFromSource
|
||||
|
||||
echo "# clboss was updated to the latest master commit"
|
||||
echo "# Restarting ${netprefix}lightningd to activate"
|
||||
sudo systemctl restart ${netprefix}lightningd
|
||||
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "# FAIL - Unknown Parameter $1"
|
||||
exit 1
|
||||
|
@ -1,205 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# explanation on paths https://github.com/ElementsProject/lightning/issues/4223
|
||||
# built-in path dir: /usr/local/libexec/c-lightning/plugins/
|
||||
# added --plugin-dir=/home/bitcoin/${netprefix}cl-plugins-enabled
|
||||
|
||||
SPARKOVERSION="v2.8"
|
||||
|
||||
# command info
|
||||
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
|
||||
echo
|
||||
echo "Install, remove, connect or get info about the Sparko plugin for Core Lightning"
|
||||
echo "version: $SPARKOVERSION"
|
||||
echo "Usage:"
|
||||
echo "cl-plugin.sparko.sh [on|off|menu|connect] [testnet|mainnet|signet] [norestart]"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# source <(/home/admin/config.scripts/network.aliases.sh getvars cl <mainnet|testnet|signet>)
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
|
||||
|
||||
# show info menu
|
||||
if [ "$1" = "menu" ]; then
|
||||
|
||||
# get network info
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}sparko/hostname)
|
||||
toraddresstext="Hidden Service address for the Tor Browser (QRcode on LCD):\n$toraddress"
|
||||
if [ ${#toraddress} -eq 0 ];then
|
||||
toraddresstext="Activate Tor to access the web interface from outside of the local network."
|
||||
else
|
||||
sudo /home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
|
||||
fi
|
||||
fingerprint=$(openssl x509 -in /home/bitcoin/.lightning/sparko-tls/cert.pem -fingerprint -noout | cut -d"=" -f2)
|
||||
|
||||
whiptail --title "\
|
||||
Sparko - $CHAIN" --msgbox "Open in your local web browser:
|
||||
https://${localip}:${portprefix}9000\n
|
||||
username: blitz
|
||||
password: 'your Password B'\n
|
||||
Accept the self-signed SSL certificate with the fingerprint:
|
||||
${fingerprint}\n
|
||||
${toraddresstext}
|
||||
" 17 67
|
||||
|
||||
sudo /home/admin/config.scripts/blitz.display.sh hide
|
||||
|
||||
echo "# please wait ..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $1 = connect ];then
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}sparko/hostname)
|
||||
accesskey=$(sudo cat ${CLCONF} | grep "^sparko-keys=" | cut -d= -f2 | cut -d';' -f1)
|
||||
url="https://${localip}:${portprefix}9000/"
|
||||
#string="${url}?access-key=${accesskey}"
|
||||
#sudo /home/admin/config.scripts/blitz.display.sh qr "$string"
|
||||
#clear
|
||||
#echo "connection string (shown as a QRcode on the top and on the LCD):"
|
||||
#echo "$string"
|
||||
#qrencode -t ANSIUTF8 "${string}"
|
||||
clear
|
||||
echo
|
||||
sudo /home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
|
||||
echo "The Tor address is shown as a QRcode below and on the LCD"
|
||||
echo "Scan it to your phone with a QR scanner app and paste it to: 'Host'"
|
||||
echo
|
||||
echo "Host: ${toraddress}"
|
||||
echo
|
||||
qrencode -t ANSIUTF8 "${toraddress}"
|
||||
echo
|
||||
echo
|
||||
echo "Alternatively to connect through the LAN the address is:"
|
||||
echo "${url}"
|
||||
echo
|
||||
echo "# Press enter to continue to show the access key"
|
||||
read key
|
||||
sudo /home/admin/config.scripts/blitz.display.sh hide
|
||||
sudo /home/admin/config.scripts/blitz.display.sh qr "${accesskey}"
|
||||
clear
|
||||
echo
|
||||
echo "The Access Key is shown as a QRcode below and on the LCD"
|
||||
echo "Scan it to your phone with a QR scanner app and paste it to: 'Access Key'"
|
||||
echo
|
||||
echo "Acces Key: ${accesskey}"
|
||||
echo
|
||||
qrencode -t ANSIUTF8 "${accesskey}"
|
||||
echo
|
||||
echo "# Press enter to hide the QRcode from the LCD"
|
||||
read key
|
||||
sudo /home/admin/config.scripts/blitz.display.sh hide
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "on" ];then
|
||||
echo "# Detect CPU architecture ..."
|
||||
isARM=$(uname -m | grep -c 'arm')
|
||||
isAARCH64=$(uname -m | grep -c 'aarch64')
|
||||
isX86_64=$(uname -m | grep -c 'x86_64')
|
||||
|
||||
if [ ${isARM} -eq 1 ] ; then
|
||||
DISTRO="linux-arm"
|
||||
elif [ ${isAARCH64} -eq 1 ] ; then
|
||||
DISTRO="linux_arm"
|
||||
elif [ ${isX86_64} -eq 1 ] ; then
|
||||
DISTRO="linux_amd64"
|
||||
fi
|
||||
|
||||
if [ ! -f /home/bitcoin/cl-plugins-available/sparko ];then
|
||||
sudo -u bitcoin mkdir /home/bitcoin/cl-plugins-available
|
||||
# download binary
|
||||
sudo -u bitcoin wget https://github.com/fiatjaf/sparko/releases/download/${SPARKOVERSION}/sparko_${DISTRO}\
|
||||
-O /home/bitcoin/cl-plugins-available/sparko || exit 1
|
||||
# make executable
|
||||
sudo chmod +x /home/bitcoin/cl-plugins-available/sparko
|
||||
fi
|
||||
|
||||
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ];then
|
||||
sudo ln -s /home/bitcoin/cl-plugins-available/sparko \
|
||||
/home/bitcoin/${netprefix}cl-plugins-enabled
|
||||
fi
|
||||
|
||||
if [ ! -f /home/bitcoin/.lightning/sparko-tls/key.pem ];then
|
||||
# create a self signed cert https://github.com/fiatjaf/sparko#how-to-use
|
||||
/home/admin/config.scripts/internet.selfsignedcert.sh
|
||||
# sparko looks for specific filenames
|
||||
sudo -u bitcoin mkdir /home/bitcoin/.lightning/sparko-tls
|
||||
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.key \
|
||||
/home/bitcoin/.lightning/sparko-tls/key.pem
|
||||
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.cert \
|
||||
/home/bitcoin/.lightning/sparko-tls/cert.pem
|
||||
fi
|
||||
|
||||
##########
|
||||
# Config #
|
||||
##########
|
||||
if ! grep -Eq "^sparko" ${CLCONF};then
|
||||
echo "# Editing ${CLCONF}"
|
||||
echo "# See: https://github.com/fiatjaf/sparko#how-to-use"
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
|
||||
# Spark wallet only allows alphanumeric characters
|
||||
masterkeythatcandoeverything=$(< /dev/urandom tr -dc a-zA-Z0-9 | head -c20)
|
||||
secretaccesskeythatcanreadstuff=$(< /dev/urandom tr -dc a-zA-Z0-9 | head -c20)
|
||||
verysecretkeythatcanpayinvoices=$(< /dev/urandom tr -dc a-zA-Z0-9 | head -c20)
|
||||
keythatcanlistentoallevents=$(< /dev/urandom tr -dc a-zA-Z0-9 | head -c20)
|
||||
echo "
|
||||
sparko-host=0.0.0.0
|
||||
sparko-port=${portprefix}9000
|
||||
sparko-tls-path=/home/bitcoin/.lightning/sparko-tls
|
||||
sparko-login=blitz:$PASSWORD_B
|
||||
sparko-keys=${masterkeythatcandoeverything}; ${secretaccesskeythatcanreadstuff}: getinfo, listchannels, listnodes; ${verysecretkeythatcanpayinvoices}: pay; ${keythatcanlistentoallevents}: stream
|
||||
" | sudo tee -a ${CLCONF}
|
||||
else
|
||||
echo "# Sparko is already configured in ${CLCONF}"
|
||||
fi
|
||||
|
||||
echo "# Allowing port ${portprefix}9000 through the firewall"
|
||||
sudo ufw allow "${portprefix}9000" comment "${netprefix}sparko"
|
||||
|
||||
# hidden service to https://xx.onion
|
||||
/home/admin/config.scripts/tor.onion-service.sh ${netprefix}sparko 443 ${portprefix}9000
|
||||
|
||||
# setting value in raspi blitz config
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}sparko "on"
|
||||
|
||||
source <(/home/admin/_cache.sh get state)
|
||||
if [ "${state}" == "ready" ] && [ "$3" != "norestart" ]; then
|
||||
echo "# Restart the ${netprefix}lightningd.service to activate Sparko"
|
||||
sudo systemctl restart ${netprefix}lightningd
|
||||
fi
|
||||
|
||||
echo "# Sparko was installed"
|
||||
echo "# Monitor with:"
|
||||
echo "sudo journalctl | grep sparko | tail -n5"
|
||||
echo "sudo tail -n 100 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log | grep sparko"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$1" = "off" ];then
|
||||
# delete symlink
|
||||
sudo rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/sparko
|
||||
|
||||
echo "# Editing ${CLCONF}"
|
||||
sudo sed -i "/^sparko/d" ${CLCONF}
|
||||
|
||||
echo "# Restart the ${netprefix}lightningd.service to deactivate Sparko"
|
||||
sudo systemctl restart ${netprefix}lightningd
|
||||
|
||||
echo "# Deny port ${portprefix}9000 through the firewall"
|
||||
sudo ufw deny "${portprefix}9000"
|
||||
|
||||
/home/admin/config.scripts/tor.onion-service.sh off ${netprefix}sparko
|
||||
|
||||
# purge
|
||||
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
|
||||
echo "# Delete plugin"
|
||||
sudo rm -rf /home/bitcoin/cl-plugins-available/sparko
|
||||
fi
|
||||
# setting value in raspi blitz config
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}sparko "off"
|
||||
echo "# Sparko was uninstalled"
|
||||
|
||||
fi
|
@ -34,15 +34,6 @@ if [ "$1" == "prestart" ]; then
|
||||
sed -i "/^announce-addr=127.0.0.1/d" ${CLCONF}
|
||||
fi
|
||||
|
||||
if [ $(grep -c "^sparko" < ${CLCONF}) -gt 0 ];then
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ]\
|
||||
|| [ "$(eval echo \$${netprefix}sparko)" != "on" ]; then
|
||||
echo "# The Sparko plugin is not present but in config"
|
||||
sed -i "/^sparko/d" ${CLCONF}
|
||||
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/sparko
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $(grep -c "^clboss" < ${CLCONF}) -gt 0 ];then
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/clboss ]\
|
||||
|| [ "$(eval echo \$${netprefix}clboss)" != "on" ]; then
|
||||
|
@ -13,13 +13,6 @@ fi
|
||||
# source <(/home/admin/config.scripts/network.aliases.sh getvars cl <mainnet|testnet|signet>)
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
|
||||
|
||||
if [ $(sudo -u bitcoin cat ${CLCONF} | grep -c "^sparko") -gt 0 ];then
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ];then
|
||||
echo "# The Sparko plugin is not present but in config"
|
||||
/home/admin/config.scripts/cl-plugin.sparko.sh on $CHAIN norestart
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $(sudo -u bitcoin cat ${CLCONF} | grep -c "^http-pass") -gt 0 ];then
|
||||
if [ ! -f /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ]; then
|
||||
echo "# The clHTTPplugin is not present but in config"
|
||||
|
@ -2,7 +2,7 @@
|
||||
# https://lightning.readthedocs.io/
|
||||
|
||||
# https://github.com/ElementsProject/lightning/releases
|
||||
CLVERSION="v23.05.2"
|
||||
CLVERSION="v23.08"
|
||||
|
||||
# install the latest master by using the last commit id
|
||||
# https://github.com/ElementsProject/lightning/commit/master
|
||||
@ -58,7 +58,7 @@ function installDependencies() {
|
||||
function buildAndInstallCLbinaries() {
|
||||
echo "- Configuring EXPERIMENTAL_FEATURES enabled"
|
||||
echo
|
||||
sudo -u bitcoin ./configure --enable-experimental-features
|
||||
sudo -u bitcoin ./configure
|
||||
echo
|
||||
echo "- Building Core lightning from source"
|
||||
echo
|
||||
@ -367,9 +367,6 @@ alias ${netprefix}clconf=\"sudo nano ${CLCONF}\"
|
||||
# setting values in the raspiblitz.conf
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}cl on
|
||||
# blitz.conf.sh needs sudo access - cannot be run in cl.check.sh
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ]; then
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}sparko "off"
|
||||
fi
|
||||
if [ ! -f /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ]; then
|
||||
/home/admin/config.scripts/blitz.conf.sh set clHTTPplugin "off"
|
||||
fi
|
||||
|
@ -1,173 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#https://github.com/shesek/spark-wallet/releases
|
||||
SPARKVERSION="v0.3.1"
|
||||
|
||||
# command info
|
||||
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
|
||||
echo
|
||||
echo "Install, remove or get info about the Spark Wallet for Core Lightning"
|
||||
echo "version: $SPARKVERSION"
|
||||
echo "Usage:"
|
||||
echo "cl.spark.sh [on|off|menu] <testnet|mainnet|signet> "
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# source <(/home/admin/config.scripts/network.aliases.sh getvars cl <mainnet|testnet|signet>)
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
|
||||
systemdService="${netprefix}spark"
|
||||
|
||||
# show info menu
|
||||
if [ "$1" = "menu" ]; then
|
||||
|
||||
# get network info
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}spark-wallet/hostname)
|
||||
toraddresstext="Hidden Service address for the Tor Browser (QRcode on LCD):\n$toraddress"
|
||||
if [ ${#toraddress} -eq 0 ];then
|
||||
toraddresstext="Activate Tor to access the web interface from outside of the local network."
|
||||
else
|
||||
sudo /home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
|
||||
fi
|
||||
fingerprint=$(openssl x509 -in /home/bitcoin/.spark-wallet/tls/cert.pem -fingerprint -noout | cut -d"=" -f2)
|
||||
|
||||
whiptail --title "\
|
||||
spark - $CHAIN" --msgbox "Open in your local web browser:
|
||||
https://${localip}:${portprefix}8000\n
|
||||
username: blitz
|
||||
password: 'your Password B'\n
|
||||
Accept the self-signed SSL certificate with the fingerprint:
|
||||
${fingerprint}\n
|
||||
${toraddresstext}
|
||||
" 17 67
|
||||
|
||||
sudo /home/admin/config.scripts/blitz.display.sh hide
|
||||
|
||||
echo "# please wait ..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $1 = on ];then
|
||||
|
||||
# check and install NodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
|
||||
# set up npm-global
|
||||
sudo -u bitcoin mkdir /home/bitcoin/.npm-global
|
||||
sudo -u bitcoin npm config set prefix '/home/bitcoin/.npm-global'
|
||||
sudo bash -c "echo 'PATH=$PATH:/home/bitcoin/.npm-global/bin' >> /home/bitcoin/.bashrc"
|
||||
|
||||
echo "# Create data folder on the disk"
|
||||
echo "# make sure the data directory exists"
|
||||
sudo mkdir -p /mnt/hdd/app-data/.spark-wallet
|
||||
echo "# symlink"
|
||||
sudo rm -rf /home/bitcoin/.spark-wallet # not a symlink.. delete it silently
|
||||
sudo ln -s /mnt/hdd/app-data/.spark-wallet/ /home/bitcoin/.spark-wallet
|
||||
sudo chown bitcoin:bitcoin -R /mnt/hdd/app-data/.spark-wallet
|
||||
|
||||
cd /home/bitcoin || exit 1
|
||||
sudo -u bitcoin git clone https://github.com/shesek/spark-wallet
|
||||
cd spark-wallet || exit 1
|
||||
sudo -u bitcoin git reset --hard ${SPARKVERSION} || exit 1
|
||||
sudo -u bitcoin npm install @babel/cli
|
||||
sudo -u bitcoin npm run dist:npm || exit 1
|
||||
|
||||
if [ ! -f /home/bitcoin/.spark-wallet/tls/key.pem ];then
|
||||
echo "# creating /home/bitcoin/.spark-wallet/tls/key.pem"
|
||||
# create a self signed cert https://github.com/fiatjaf/spark#how-to-use
|
||||
/home/admin/config.scripts/internet.selfsignedcert.sh
|
||||
# spark looks for specific filenames
|
||||
sudo -u bitcoin mkdir -p /home/bitcoin/.spark-wallet/tls/
|
||||
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.key \
|
||||
/home/bitcoin/.spark-wallet/tls/key.pem
|
||||
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.cert \
|
||||
/home/bitcoin/.spark-wallet/tls/cert.pem
|
||||
else
|
||||
echo "# exists /home/bitcoin/.spark-wallet/tls/key.pem"
|
||||
fi
|
||||
|
||||
##########
|
||||
# Config #
|
||||
##########
|
||||
if [ -f /home/bitcoin/.spark-wallet/${netprefix}config ];then
|
||||
echo "# ${netprefix}spark config is already present"
|
||||
else
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
|
||||
echo "\
|
||||
login=blitz:${PASSWORD_B}
|
||||
host=0.0.0.0
|
||||
proxy=socks5h://127.0.0.1:9050
|
||||
tls-path=/home/bitcoin/.lightning/spark-tls
|
||||
onion
|
||||
" | sudo -u bitcoin tee /home/bitcoin/.spark-wallet/${netprefix}config
|
||||
fi
|
||||
|
||||
#################
|
||||
# SYSTEMD SERVICE
|
||||
#################
|
||||
# https://raw.githubusercontent.com/shesek/spark-wallet/master/scripts/spark-wallet.service
|
||||
echo "# Create Systemd Service: ${systemdService}.service"
|
||||
echo "
|
||||
# Systemd unit for ${systemdService}
|
||||
|
||||
[Unit]
|
||||
Description=${systemdService} Lightning Wallet
|
||||
Wants=${netprefix}lightningd.service
|
||||
After=${netprefix}lightningd.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/home/bitcoin/spark-wallet
|
||||
ExecStart=/home/bitcoin/spark-wallet/dist/cli.js\
|
||||
--ln-path /home/bitcoin/.lightning/${CLNETWORK} --port 8000\
|
||||
--config /home/bitcoin/.spark-wallet/config
|
||||
User=bitcoin
|
||||
Restart=on-failure
|
||||
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/${systemdService}.service
|
||||
sudo chown root:root /etc/systemd/system/${systemdService}.service
|
||||
|
||||
echo "# Allowing port ${portprefix}8000 through the firewall"
|
||||
sudo ufw allow "${portprefix}8000" comment "${netprefix}spark-wallet"
|
||||
|
||||
/home/admin/config.scripts/tor.onion-service.sh ${netprefix}spark-wallet 443 ${portprefix}8000
|
||||
|
||||
# setting value in raspi blitz config
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}spark "on"
|
||||
|
||||
sudo systemctl enable ${systemdService}
|
||||
sudo systemctl start ${systemdService}
|
||||
echo "# OK - the ${systemdService}.service is now enabled & started"
|
||||
echo "# Monitor with: sudo journalctl -f -u ${systemdService}"
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
if [ $1 = off ];then
|
||||
|
||||
sudo systemctl stop ${systemdService} 2>/dev/null
|
||||
sudo systemctl disable ${systemdService} 2>/dev/null
|
||||
|
||||
/home/admin/config.scripts/tor.onion-service.sh off ${netprefix}spark-wallet
|
||||
|
||||
# purge
|
||||
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
|
||||
echo "# Delete install directory"
|
||||
sudo rm -rf /home/bitcoin/spark-wallet
|
||||
fi
|
||||
# setting value in raspi blitz config
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}spark "off"
|
||||
echo "# ${netprefix}spark was uninstalled"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user