btcpay default to v1.5.4, improve update and off

This commit is contained in:
openoms 2022-05-28 19:48:45 +01:00
parent e3519a9c27
commit c9802cb9af
No known key found for this signature in database
GPG Key ID: 5BFB77609B081B65

View File

@ -5,11 +5,7 @@
# https://github.com/dgarage/NBXplorer/tags # https://github.com/dgarage/NBXplorer/tags
NBXplorerVersion="v2.2.20" NBXplorerVersion="v2.2.20"
# https://github.com/btcpayserver/btcpayserver/releases # https://github.com/btcpayserver/btcpayserver/releases
BTCPayVersion="v1.4.4" BTCPayVersion="v1.5.4"
PGPsigner="nicolasdorier"
PGPpubkeyLink="https://keybase.io/nicolasdorier/pgp_keys.asc"
PGPpubkeyFingerprint="AB4CFA9895ACA0DBE27F6B346618763EF09186FE"
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@ -38,7 +34,11 @@ if [ "$1" = "status" ]; then
localIP=$(hostname -I | awk '{print $1}') localIP=$(hostname -I | awk '{print $1}')
echo "localIP='${localIP}'" echo "localIP='${localIP}'"
echo "httpPort='23000'"
echo "httpsPort='23001'" echo "httpsPort='23001'"
echo "httpsForced='1'"
echo "httpsSelfsigned='1'" # TODO: change later if IP2Tor+LetsEncrypt is active
echo "authMethod='userdefined'"
echo "publicIP='${publicIP}'" echo "publicIP='${publicIP}'"
# check for LetsEncryptDomain for DynDns # check for LetsEncryptDomain for DynDns
@ -336,6 +336,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
cd NBXplorer || exit 1 cd NBXplorer || exit 1
sudo -u btcpay git reset --hard $NBXplorerVersion sudo -u btcpay git reset --hard $NBXplorerVersion
# PGP verify # PGP verify
PGPsigner="nicolasdorier"
PGPpubkeyLink="https://keybase.io/nicolasdorier/pgp_keys.asc"
PGPpubkeyFingerprint="AB4CFA9895ACA0DBE27F6B346618763EF09186FE"
sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \ sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1 "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
echo "# Build NBXplorer ..." echo "# Build NBXplorer ..."
@ -432,6 +437,10 @@ btc.rpc.password=$PASSWORD_B
# sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \ # sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
# "web-flow" "https://github.com/web-flow.gpg" "4AEE18F83AFDEB23" || exit 1 # "web-flow" "https://github.com/web-flow.gpg" "4AEE18F83AFDEB23" || exit 1
PGPsigner="Kukks"
PGPpubkeyLink="https://github.com/${PGPsigner}.gpg"
PGPpubkeyFingerprint="8E5530D9D1C93097"
sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \ sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1 "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
@ -476,8 +485,8 @@ WantedBy=multi-user.target
sudo systemctl start btcpayserver sudo systemctl start btcpayserver
echo "# Checking for btcpayserver config" echo "# Checking for btcpayserver config"
while [ ! -f "/home/btcpay/.btcpayserver/Main/settings.config" ]; do while [ ! -f "/home/btcpay/.btcpayserver/Main/settings.config" ]; do
echo "# Waiting for btcpayserver to start - CTRL+C to abort" echo "# Waiting for btcpayserver to start - CTRL+C to abort .."
sleep 10 sleep 30
hasFailed=$(sudo systemctl status btcpayserver | grep -c "Active: failed") hasFailed=$(sudo systemctl status btcpayserver | grep -c "Active: failed")
if [ ${hasFailed} -eq 1 ]; then if [ ${hasFailed} -eq 1 ]; then
echo "# seems like starting btcpayserver service has failed - see: systemctl status btcpayserver" echo "# seems like starting btcpayserver service has failed - see: systemctl status btcpayserver"
@ -503,6 +512,9 @@ WantedBy=multi-user.target
# setting value in raspi blitz config # setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set BTCPayServer "on" /home/admin/config.scripts/blitz.conf.sh set BTCPayServer "on"
# needed for API/WebUI as signal that install ran thru
echo "result='OK'"
exit 0 exit 0
fi fi
@ -540,6 +552,10 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo systemctl stop btcpayserver sudo systemctl stop btcpayserver
sudo systemctl disable btcpayserver sudo systemctl disable btcpayserver
sudo rm /etc/systemd/system/btcpayserver.service sudo rm /etc/systemd/system/btcpayserver.service
else
echo "# The btcpayserver.service is not installed."
fi
# nbxplorer # nbxplorer
sudo systemctl stop nbxplorer sudo systemctl stop nbxplorer
sudo systemctl disable nbxplorer sudo systemctl disable nbxplorer
@ -573,55 +589,57 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "# keeping data" echo "# keeping data"
fi fi
echo "# OK BTCPayServer removed." echo "# OK BTCPayServer removed."
else
echo "# BTCPayServer is not installed." # needed for API/WebUI as signal that install ran thru
fi echo "result='OK'"
exit 0 exit 0
fi fi
if [ "$1" = "update" ]; then if [ "$1" = "update" ]; then
echo "# Update NBXplorer" ## don't update NBXplorer until https://github.com/rootzoll/raspiblitz/issues/3055 is solved
cd /home/btcpay || exit 1 # echo "# Update NBXplorer"
cd NBXplorer || exit 1 # cd /home/btcpay || exit 1
# fetch latest master # cd NBXplorer || exit 1
if [ "$(sudo -u btcpay git fetch 2>&1 | grep -c "Please tell me who you are")" -gt 0 ]; then # # fetch latest master
sudo -u btcpay git config user.email "you@example.com" # if [ "$(sudo -u btcpay git fetch 2>&1 | grep -c "Please tell me who you are")" -gt 0 ]; then
sudo -u btcpay git config user.name "Your Name" # sudo -u btcpay git config user.email "you@example.com"
fi # sudo -u btcpay git config user.name "Your Name"
sudo -u btcpay git fetch # fi
# unset $1 # sudo -u btcpay git fetch
set -- # # unset $1
UPSTREAM=${1:-'@{u}'} # set --
LOCAL=$(git rev-parse @) # UPSTREAM=${1:-'@{u}'}
REMOTE=$(git rev-parse "$UPSTREAM") # LOCAL=$(git rev-parse @)
# REMOTE=$(git rev-parse "$UPSTREAM")
if [ $LOCAL = $REMOTE ]; then #
TAG=$(git tag | sort -V | tail -1) # if [ $LOCAL = $REMOTE ]; then
echo "# Up-to-date on version $TAG" # TAG=$(git tag | sort -V | tail -1)
else # echo "# Up-to-date on version $TAG"
echo "# Pulling latest changes..." # else
sudo -u btcpay git pull -p # echo "# Pulling latest changes..."
TAG=$(git tag | sort -V | tail -1) # sudo -u btcpay git pull -p
echo "# Reset to the latest release tag: $TAG" # TAG=$(git tag | sort -V | tail -1)
sudo -u btcpay git reset --hard $TAG # echo "# Reset to the latest release tag: $TAG"
sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \ # sudo -u btcpay git reset --hard $TAG
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1 # sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
echo "# Build NBXplorer ..." # "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
# from the build.sh with path # echo "# Build NBXplorer ..."
sudo systemctl stop nbxplorer # # from the build.sh with path
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj # sudo systemctl stop nbxplorer
# sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj
# whitelist localhost in bitcoind #
if ! sudo grep -Eq "^whitelist=127.0.0.1" /mnt/hdd/bitcoin/bitcoin.conf;then # # whitelist localhost in bitcoind
echo "whitelist=127.0.0.1" | sudo tee -a /mnt/hdd/bitcoin/bitcoin.conf # if ! sudo grep -Eq "^whitelist=127.0.0.1" /mnt/hdd/bitcoin/bitcoin.conf;then
echo "# Restarting bitcoind" # echo "whitelist=127.0.0.1" | sudo tee -a /mnt/hdd/bitcoin/bitcoin.conf
sudo systemctl restart bitcoind # echo "# Restarting bitcoind"
fi # sudo systemctl restart bitcoind
# fi
sudo systemctl start nbxplorer #
echo "# Updated NBXplorer to $TAG" # sudo systemctl start nbxplorer
fi # echo "# Updated NBXplorer to $TAG"
# fi
echo "# Update BTCPayServer" echo "# Update BTCPayServer"
cd /home/btcpay || exit 1 cd /home/btcpay || exit 1