diff --git a/CHANGES.md b/CHANGES.md index 34147e3ad..56581a897 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,12 @@ # CHANGES between Releases +## What's new in Version 1.7.1 of RaspiBlitz? + +- Update: Lightning Terminal v0.5.0-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.5.0-alpha) +- Update: Pool CLI v0.5.1-alpha [details](https://github.com/lightninglabs/pool/releases/tag/v0.5.1-alpha) - Update: Balance of Satoshis 10.7.8 (BOS) + keep data on reinstall [details](https://github.com/alexbosworth/balanceofsatoshis/blob/master/CHANGELOG.md#version-8010) - Update: mempool space 2.2.1 [details](https://github.com/mempool/mempool) +- Fix: Prevent Pool dataloss on SDcard update [details](https://github.com/rootzoll/raspiblitz/issues/2266) ## What's new in Version 1.7.0 of RaspiBlitz? diff --git a/home.admin/_provision_.sh b/home.admin/_provision_.sh index 2d0ce2c34..baa228f87 100755 --- a/home.admin/_provision_.sh +++ b/home.admin/_provision_.sh @@ -378,7 +378,8 @@ else fi #LOOP -if [ "${loop}" = "on" ]; then +# install only if LiT won't be installed +if [ "${loop}" = "on" ] && [ "${#lit}" -eq 0 ] || [ "${lit}" = "off" ]; then echo "Provisioning Lightning Loop - run config script" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup Lightning Loop'/g" ${infoFile} sudo -u admin /home/admin/config.scripts/bonus.loop.sh on >> ${logFile} 2>&1 @@ -615,6 +616,16 @@ else echo "Provisioning Stacking Sats Kraken - keep default" >> ${logFile} fi +# Pool +# install only if LiT won't be installed +if [ "${pool}" = "on" ] && [ "${#lit}" -eq 0 ] || [ "${lit}" = "off" ]; then + echo "Provisioning Pool - run config script" >> ${logFile} + sudo sed -i "s/^message=.*/message='Setup Pool'/g" ${infoFile} + sudo -u admin /home/admin/config.scripts/bonus.pool.sh on >> ${logFile} 2>&1 +else + echo "Provisioning Pool - keep default" >> ${logFile} +fi + # lit (make sure to be installed after RTL) if [ "${lit}" = "on" ]; then echo "Provisioning LIT - run config script" >> ${logFile} @@ -624,15 +635,6 @@ else echo "Provisioning LIT - keep default" >> ${logFile} fi -# pool -if [ "${pool}" = "on" ]; then - echo "Provisioning Pool - run config script" >> ${logFile} - sudo sed -i "s/^message=.*/message='Setup Pool'/g" ${infoFile} - sudo -u admin /home/admin/config.scripts/bonus.pool.sh on >> ${logFile} 2>&1 -else - echo "Provisioning Pool - keep default" >> ${logFile} -fi - # sphinxrelay if [ "${sphinxrelay}" = "on" ]; then echo "Sphinx-Relay - run config script" >> ${logFile} diff --git a/home.admin/config.scripts/bonus.lit.sh b/home.admin/config.scripts/bonus.lit.sh index e441d6d62..b33466582 100644 --- a/home.admin/config.scripts/bonus.lit.sh +++ b/home.admin/config.scripts/bonus.lit.sh @@ -1,7 +1,7 @@ #!/bin/bash # https://github.com/lightninglabs/lightning-terminal/releases -LITVERSION="0.4.1-alpha" +LITVERSION="0.5.0-alpha" # command info if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then @@ -12,10 +12,14 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then fi # check who signed the release in https://github.com/lightninglabs/lightning-terminal/releases -PGPsigner="guggero" -if [ $PGPsigner=guggero ];then +PGPsigner="roasbeef" + +if [ $PGPsigner = guggero ];then PGPpkeys="https://keybase.io/guggero/pgp_keys.asc" PGPcheck="03DB6322267C373B" +elif [ $PGPsigner = roasbeef ];then + PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc " + PGPcheck="3BBD59E99B280306" fi source /mnt/hdd/raspiblitz.conf @@ -238,9 +242,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then # Application Options httpslisten=0.0.0.0:8443 uipassword=$PASSWORD_B -#letsencrypt=true -#letsencrypthost=loop.merchant.com -lit-dir=/home/lit/.lit # Remote options remote.lit-debuglevel=debug @@ -351,9 +352,6 @@ fi # switch off if [ "$1" = "0" ] || [ "$1" = "off" ]; then - # setting value in raspi blitz config - sudo sed -i "s/^lit=.*/lit=off/g" /mnt/hdd/raspiblitz.conf - isInstalled=$(sudo ls /etc/systemd/system/litd.service 2>/dev/null | grep -c 'litd.service') if [ ${isInstalled} -eq 1 ]; then echo "*** REMOVING LIT ***" @@ -361,8 +359,6 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then sudo systemctl stop litd sudo systemctl disable litd sudo rm /etc/systemd/system/litd.service - # delete user - sudo userdel -rf lit # close ports on firewall sudo ufw deny 8443 # delete Go package @@ -375,6 +371,14 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then else echo "# LiT is not installed." fi + + # clean up anyway + # delete user + sudo userdel -rf lit + # delete group + sudo groupdel lit + # setting value in raspi blitz config + sudo sed -i "s/^lit=.*/lit=off/g" /mnt/hdd/raspiblitz.conf exit 0 fi diff --git a/home.admin/config.scripts/bonus.pool.sh b/home.admin/config.scripts/bonus.pool.sh index a0df6b1d1..425547596 100644 --- a/home.admin/config.scripts/bonus.pool.sh +++ b/home.admin/config.scripts/bonus.pool.sh @@ -5,13 +5,14 @@ # but main focus for the future development should be on LIT # https://github.com/lightninglabs/pool/releases/ -pinnedVersion="v0.3.4-alpha" +poolVersion="v0.5.1-alpha" # command info if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then - echo "# config script to switch Lightning Pool on, off or update" - echo "# bonus.pool.sh [on|off|menu|update]" - echo "# DEPRECATED use instead: bonus.lit.sh" + echo "# config script to switch the Lightning Pool CLI on or off" + echo "# bonus.pool.sh [on|off|menu]" + echo "# this Pool instance is CLI only." + echo "# for a GUI use 'bonus.lit.sh' instead" exit 1 fi @@ -39,15 +40,12 @@ sudo systemctl stop poold 2>/dev/null if [ "$1" = "1" ] || [ "$1" = "on" ]; then echo "# installing pool" + echo "# remove LiT to avoid interference with accounts (data is preserved)" + /home/admin/config.scripts/bonus.lit.sh off + isInstalled=$(sudo ls /etc/systemd/system/poold.service 2>/dev/null | grep -c 'poold.service') if [ ${isInstalled} -eq 0 ]; then - # install Go - /home/admin/config.scripts/bonus.go.sh on - - # get Go vars - source /etc/profile - # create dedicated user sudo adduser --disabled-password --gecos "" pool @@ -67,15 +65,111 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then # create symlink sudo ln -s /mnt/hdd/app-data/lnd/ /home/pool/.lnd + + # install from binary + + downloadDir="/home/admin/download/pool" # edit your download directory + rm -rf "${downloadDir}" + mkdir -p "${downloadDir}" + cd "${downloadDir}" || exit 1 + + # check who signed the release in https://github.com/lightninglabs/pool/releases + PGPsigner="roasbeef" + if [ $PGPsigner = "roasbeef" ];then + PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc" + PGPcheck="372CBD7633C61696" + fi + if [ $PGPsigner = "guggero" ];then + PGPpkeys="https://keybase.io/guggero/pgp_keys.asc" + PGPcheck="03DB6322267C373B" + fi + + 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 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ]; then + echo "!!! FAIL !!!" + echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" + uname -m + exit 1 + else + echo "OK running on $(uname -m) architecture." + fi + + # extract the SHA256 hash from the manifest file for the corresponding platform + #https://github.com/lightninglabs/pool/releases/download/v0.5.0-alpha/manifest-v0.5.0-alpha.txt + wget -N https://github.com/lightninglabs/pool/releases/download/${poolVersion}/manifest-${poolVersion}.txt + if [ ${isARM} -eq 1 ] ; then + OSversion="armv7" + elif [ ${isAARCH64} -eq 1 ] ; then + OSversion="arm64" + elif [ ${isX86_64} -eq 1 ] ; then + OSversion="amd64" + fi + SHA256=$(grep -i "linux-$OSversion" manifest-${poolVersion}.txt | cut -d " " -f1) + + echo + echo "# Pool ${poolVersion} for ${OSversion}" + echo "# SHA256 hash: $SHA256" + echo + echo "# get Pool binary" + binaryName="pool-linux-${OSversion}-${poolVersion}.tar.gz" + wget -N https://github.com/lightninglabs/pool/releases/download/${poolVersion}/${binaryName} + + echo "# check binary was not manipulated (checksum test)" + # https://github.com/lightninglabs/pool/releases/download/v0.5.0-alpha/manifest-v0.5.0-alpha.txt.sig + wget -N https://github.com/lightninglabs/pool/releases/download/${poolVersion}/manifest-${poolVersion}.txt.sig + sudo -u admin wget --no-check-certificate -N -O "pgp_keys.asc" ${PGPpkeys} + #wget --no-check-certificate ${PGPpkeys} + binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) + if [ "${binaryChecksum}" != "${SHA256}" ]; then + echo "!!! FAIL !!! Downloaded Pool BINARY not matching SHA256 checksum: ${SHA256}" + exit 1 + fi + + echo "# check gpg finger print" + gpg --keyid-format LONG ./pgp_keys.asc + fingerprint=$(gpg --keyid-format LONG "./pgp_keys.asc" 2>/dev/null \ + | grep "${PGPcheck}" -c) + if [ ${fingerprint} -lt 1 ]; then + echo "" + echo "!!! BUILD WARNING --> Pool PGP author not as expected" + echo "Should contain PGP: ${PGPcheck}" + echo "PRESS ENTER to TAKE THE RISK if you think all is OK" + read key + fi + gpg --import ./pgp_keys.asc + sleep 3 + verifyResult=$(gpg --verify manifest-${poolVersion}.txt.sig manifest-${poolVersion}.txt 2>&1) + goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) + echo "goodSignature(${goodSignature})" + correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${GPGcheck}" -c) + echo "correctKey(${correctKey})" + if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then + echo "" + echo "!!! BUILD FAILED --> PGP verification failed / signature(${goodSignature}) verify(${correctKey})" + exit 1 + fi + ########### + # install # + ########### + tar -xzf ${binaryName} + sudo install -m 0755 -o root -g root -t /usr/local/bin pool-linux-${OSversion}-${poolVersion}/* + # install from source - cd /home/pool - - sudo -u pool git clone https://github.com/lightninglabs/pool.git || exit 1 - cd /home/pool/pool - # pin version - sudo -u pool git reset --hard $pinnedVersion - # install to /home/pool/go/bin/ - sudo -u pool /usr/local/go/bin/go install ./... || exit 1 + # install Go + # /home/admin/config.scripts/bonus.go.sh on + # get Go vars + # source /etc/profile + # cd /home/pool + # + # sudo -u pool git clone https://github.com/lightninglabs/pool.git || exit 1 + # cd /home/pool/pool + # # pin version + # sudo -u pool git reset --hard $pinnedVersion + # # install to /home/pool/go/bin/ + # sudo -u pool /usr/local/go/bin/go install ./... || exit 1 # sync all macaroons and unix groups for access /home/admin/config.scripts/lnd.credentials.sh sync @@ -110,7 +204,7 @@ Description=poold.service After=lnd.service [Service] -ExecStart=$proxy /home/pool/go/bin/poold --network=${chain}net --debuglevel=trace +ExecStart=$proxy /usr/local/bin/poold --network=${chain}net --debuglevel=trace User=pool Group=pool Type=simple @@ -144,7 +238,7 @@ WantedBy=multi-user.target # setting value in raspi blitz config sudo sed -i "s/^pool=.*/pool=on/g" /mnt/hdd/raspiblitz.conf - isInstalled=$(sudo -u pool /home/pool/go/bin/pool | grep -c pool) + isInstalled=$(sudo -u pool /usr/local/bin/poold | grep -c pool) if [ ${isInstalled} -gt 0 ]; then echo " # Usage and examples: https://github.com/lightninglabs/pool @@ -175,8 +269,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then sudo rm /etc/systemd/system/poold.service # delete user and it's home directory sudo userdel -rf pool - # remove symlink - sudo rm -r /mnt/hdd/app-data/.pool + # delete the binary + sudo rm /usr/local/bin/poold echo "# OK, the Pool Service is removed." else echo "# Pool is not installed." @@ -185,47 +279,47 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then exit 0 fi -# update -if [ "$1" = "update" ]; then - echo "# Updating Pool " - cd /home/pool/pool - # from https://github.com/apotdevin/thunderhub/blob/master/scripts/updateToLatest.sh - # fetch latest master - sudo -u pool git fetch - # unset $1 - set -- - UPSTREAM=${1:-'@{u}'} - LOCAL=$(git rev-parse @) - REMOTE=$(git rev-parse "$UPSTREAM") - - if [ $LOCAL = $REMOTE ]; then - TAG=$(git tag | sort -V | tail -1) - echo "# You are up-to-date on version" $TAG - else - echo "# Pulling the latest changes..." - sudo -u pool git pull -p - echo "# Reset to the latest release tag" - TAG=$(git tag | sort -V | tail -1) - sudo -u pool git reset --hard $TAG - echo "# Updating ..." - # install to /home/pool/go/bin/ - sudo -u pool /usr/local/go/bin/go install ./... || exit 1 - isInstalled=$(sudo -u pool /home/pool/go/bin/pool | grep -c pool) - if [ ${isInstalled} -gt 0 ]; then - TAG=$(git tag | sort -V | tail -1) - echo "# Updated to version" $TAG - else - echo "# Failed to install Lightning Pool " - exit 1 - fi - fi - - echo "# At the latest in https://github.com/lightninglabs/pool/releases/" - echo "" - echo "# Starting the poold.service ... *** " - sudo systemctl start poold - exit 0 -fi +# # update +# if [ "$1" = "update" ]; then +# echo "# Updating Pool " +# cd /home/pool/pool +# # from https://github.com/apotdevin/thunderhub/blob/master/scripts/updateToLatest.sh +# # fetch latest master +# sudo -u pool git fetch +# # unset $1 +# set -- +# UPSTREAM=${1:-'@{u}'} +# LOCAL=$(git rev-parse @) +# REMOTE=$(git rev-parse "$UPSTREAM") +# +# if [ $LOCAL = $REMOTE ]; then +# TAG=$(git tag | sort -V | tail -1) +# echo "# You are up-to-date on version" $TAG +# else +# echo "# Pulling the latest changes..." +# sudo -u pool git pull -p +# echo "# Reset to the latest release tag" +# TAG=$(git tag | sort -V | tail -1) +# sudo -u pool git reset --hard $TAG +# echo "# Updating ..." +# # install to /home/pool/go/bin/ +# sudo -u pool /usr/local/go/bin/go install ./... || exit 1 +# isInstalled=$(sudo -u pool /home/pool/go/bin/pool | grep -c pool) +# if [ ${isInstalled} -gt 0 ]; then +# TAG=$(git tag | sort -V | tail -1) +# echo "# Updated to version" $TAG +# else +# echo "# Failed to install Lightning Pool " +# exit 1 +# fi +# fi +# +# echo "# At the latest in https://github.com/lightninglabs/pool/releases/" +# echo "" +# echo "# Starting the poold.service ... *** " +# sudo systemctl start poold +# exit 0 +# fi echo "# FAIL - Unknown Parameter $1" echo "# may need reboot to run normal again"