mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-19 09:50:19 +01:00
Merge branch 'v1.5' of https://github.com/rootzoll/raspiblitz into v1.5
This commit is contained in:
commit
c23fae78ce
@ -5,7 +5,7 @@
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "config script to switch BTCPay Server on or off"
|
||||
echo "bonus.btcpayserver.sh [on|off|menu] [ip|tor]"
|
||||
echo "bonus.btcpayserver.sh [on|off|menu|write-tls-macaroon] [ip|tor]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -49,11 +49,42 @@ if ! grep -Eq "^BTCPayDomain=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "BTCPayDomain=off" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
# stop services
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop nbxplorer 2>/dev/null
|
||||
sudo systemctl stop btcpayserver 2>/dev/null
|
||||
|
||||
# write-tls-macaroon
|
||||
if [ "$1" = "write-tls-macaroon" ]; then
|
||||
# copy admin macaroon
|
||||
echo "copyin admin.macaroon for btcpay"
|
||||
sudo cp /mnt/hdd/lnd/data/chain/bitcoin/mainnet/admin.macaroon /home/btcpay/admin.macaroon
|
||||
sudo chown btcpay:btcpay /home/btcpay/admin.macaroon
|
||||
sudo chmod 600 /home/btcpay/admin.macaroon
|
||||
# set thumbprint
|
||||
FINGERPRINT=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in /home/admin/.lnd/tls.cert | cut -c 20-)
|
||||
doesNetworkEntryAlreadyExists=$(sudo cat /home/btcpay/.btcpayserver/Main/settings.config | grep -c '^network=')
|
||||
if [ ${doesNetworkEntryAlreadyExists} -eq 0 ]; then
|
||||
echo "setting the LND TLS thumbprint for BTCPay"
|
||||
echo "
|
||||
### Global settings ###
|
||||
network=mainnet
|
||||
|
||||
### Server settings ###
|
||||
port=23000
|
||||
bind=127.0.0.1
|
||||
externalurl=https://$BTCPayDomain
|
||||
|
||||
### NBXplorer settings ###
|
||||
BTC.explorer.url=http://127.0.0.1:24444/
|
||||
BTC.lightning=type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/home/btcpay/admin.macaroon;certthumbprint=$FINGERPRINT
|
||||
" | sudo -u btcpay tee -a /home/btcpay/.btcpayserver/Main/settings.config
|
||||
else
|
||||
echo "setting new LND TLS thumbprint for BTCPay"
|
||||
sudo -u btcpay sed -i \
|
||||
"s/^BTC.lightning=type=lnd-rest\;server=https\:\/\/127.0.0.1:8080\/\;macaroonfilepath=\/home\/btcpay\/admin.macaroon\;certthumbprint=.*\
|
||||
/BTC.lightning=type=lnd-rest\;server=https\:\/\/127.0.0.1:8080\/\;macaroonfilepath=\/home\/btcpay\/admin.macaroon\;certthumbprint=$FINGERPRINT/g" \
|
||||
/home/btcpay/.btcpayserver/Main/settings.config
|
||||
fi
|
||||
sudo systemctl restart btcpayserver
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "*** INSTALL BTCPAYSERVER ***"
|
||||
@ -78,6 +109,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
# check for $BTCPayDomain
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# stop services
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop nbxplorer 2>/dev/null
|
||||
sudo systemctl stop btcpayserver 2>/dev/null
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
|
||||
if [ ${isInstalled} -eq 0 ]; then
|
||||
# create btcpay user
|
||||
@ -236,7 +272,9 @@ EOF
|
||||
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git 2>/dev/null
|
||||
cd btcpayserver
|
||||
# check https://github.com/btcpayserver/btcpayserver/releases
|
||||
sudo -u btcpay git reset --hard v1.0.4.1
|
||||
#sudo -u btcpay git reset --hard v1.0.4.1
|
||||
# https://github.com/btcpayserver/btcpayserver/commits/master
|
||||
sudo -u btcpay git checkout 3a2970a495316d42c9cce0be1ddb185fcdc15352
|
||||
# from the build.sh with path
|
||||
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj
|
||||
|
||||
@ -275,30 +313,8 @@ WantedBy=multi-user.target
|
||||
fi
|
||||
done
|
||||
|
||||
# set thumbprint
|
||||
FINGERPRINT=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in /home/admin/.lnd/tls.cert | cut -c 20-)
|
||||
sudo cp /mnt/hdd/lnd/data/chain/bitcoin/mainnet/admin.macaroon /home/btcpay/admin.macaroon
|
||||
sudo chown btcpay:btcpay /home/btcpay/admin.macaroon
|
||||
sudo chmod 600 /home/btcpay/admin.macaroon
|
||||
|
||||
doesNetworkEntryAlreadyExists=$(sudo cat /home/btcpay/.btcpayserver/Main/settings.config | grep -c '^network=')
|
||||
if [ ${doesNetworkEntryAlreadyExists} -eq 0 ]; then
|
||||
echo "
|
||||
### Global settings ###
|
||||
network=mainnet
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh write-tls-macaroon
|
||||
|
||||
### Server settings ###
|
||||
port=23000
|
||||
bind=127.0.0.1
|
||||
externalurl=https://$BTCPayDomain
|
||||
|
||||
### NBXplorer settings ###
|
||||
BTC.explorer.url=http://127.0.0.1:24444/
|
||||
BTC.lightning=type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/home/btcpay/admin.macaroon;certthumbprint=$FINGERPRINT
|
||||
" | sudo -u btcpay tee -a /home/btcpay/.btcpayserver/Main/settings.config
|
||||
fi
|
||||
|
||||
sudo systemctl restart btcpayserver
|
||||
else
|
||||
echo "BTCPay Server is already installed."
|
||||
# start service
|
||||
@ -331,12 +347,9 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
sudo systemctl disable nbxplorer
|
||||
sudo rm /etc/systemd/system/nbxplorer.service
|
||||
# clear dotnet cache
|
||||
sudo -u btcpay dotnet nuget locals all --clear
|
||||
dotnet nuget locals all --clear
|
||||
sudo rm -rf /tmp/NuGetScratch
|
||||
# remove dotnet
|
||||
sudo rm -f /home/btcpay/dotnet-sdk*
|
||||
sudo rm -f /home/btcpay/aspnetcore*
|
||||
sudo rm -rf /home/btcpay/dotnet
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
# clear app config (not user data)
|
||||
sudo rm -f /home/btcpay/.nbxplorer/Main/settings.config
|
||||
@ -344,6 +357,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
# clear nginx config
|
||||
sudo rm -f /etc/nginx/sites-enabled/btcpayserver
|
||||
sudo rm -f /etc/nginx/sites-available/btcpayserver
|
||||
# nuke user
|
||||
sudo userdel -rf btcpay 2>/dev/null
|
||||
echo "OK BTCPayServer removed."
|
||||
else
|
||||
echo "BTCPayServer is not installed."
|
||||
|
@ -158,6 +158,9 @@ elif [ "${exportType}" = "reset" ]; then
|
||||
echo "- copy new macaroons to admin user"
|
||||
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${chain}net/*.macaroon /home/admin/.lnd/data/chain/${network}/${chain}net/
|
||||
sudo chown admin:admin -R /home/admin/.lnd/data/chain/${network}/${chain}net/*.macaroon
|
||||
# BTCPayServer
|
||||
if [ "${BTCPayServer}" == "on" ]; then
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh write-tls-macaroon
|
||||
# LNBits
|
||||
if [ "${LNBits}" = "on" ]; then
|
||||
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh write-macaroons
|
||||
|
Loading…
Reference in New Issue
Block a user