This commit is contained in:
rootzoll
2020-01-21 11:24:36 +01:00
3 changed files with 62 additions and 36 deletions

View File

@@ -210,6 +210,8 @@ elif [ "${abcd}" = "b" ]; then
sed -i "s/^BTCEXP_BITCOIND_URI=$network:\/\/$RPC_USER:.*@127.0.0.1:8332?timeout=10000/BTCEXP_BITCOIND_URI=$network:\/\/$RPC_USER:${newPassword}@127.0.0.1:8332\?timeout=10000/g" /home/bitcoin/.config/btc-rpc-explorer.env 2>/dev/null
sed -i "s/^BTCEXP_BITCOIND_PASS=.*/BTCEXP_BITCOIND_PASS=${newPassword}/g" /home/bitcoin/.config/btc-rpc-explorer.env 2>/dev/null
sed -i "s/^BTCEXP_BASIC_AUTH_PASSWORD=.*/BTCEXP_BASIC_AUTH_PASSWORD=${newPassword}/g" /home/bitcoin/.config/btc-rpc-explorer.env 2>/dev/null
# BTCPayServer
sed -i "s/^btc.rpc.password=.*/btc.rpc.password=${newPassword}/g" /home/btcpay/.nbxplorer/Main/settings.config 2>/dev/null
echo "OK -> RPC Password B changed"
echo "if services are running - reboot is needed to activate new settings"

View File

@@ -48,12 +48,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo mv -f /mnt/hdd/.btcpayserver/* /mnt/hdd/app-data/.btcpayserver/ 2>/dev/null
sudo rm -rf /mnt/hdd/.btcpayserver 2>/dev/null
# clean dirty SDcard (from before v1.4)
sudo mv -f /home/btcpay/.btcpayserver/* /mnt/hdd/app-data/.btcpayserver/ 2>/dev/null
sudo rm -rf /home/btcpay/.btcpayserver 2>/dev/null
sudo chown -R btcpay:btcpay /mnt/hdd/app-data/.btcpayserver
sudo -u btcpay ln -s /mnt/hdd/app-data/.btcpayserver /home/btcpay/ 2>/dev/null
sudo ln -s /mnt/hdd/app-data/.btcpayserver /home/btcpay/ 2>/dev/null
sudo chown -R btcpay:btcpay /home/btcpay/.btcpayserver
echo ""
@@ -63,11 +59,12 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo ""
# download dotnet-sdk
# https://dotnet.microsoft.com/download/dotnet-core/3.1
sudo apt-get -y install libunwind8 gettext libssl1.0
sudo -u btcpay wget https://download.visualstudio.microsoft.com/download/pr/94409a9a-41e3-4df9-83bc-9e23ed96abaf/2b75460d9a8eef8361c01bafc1783fab/dotnet-sdk-2.1.607-linux-arm.tar.gz
sudo -u btcpay wget https://download.visualstudio.microsoft.com/download/pr/d52fa156-1555-41d5-a5eb-234305fbd470/173cddb039d613c8f007c9f74371f8bb/dotnet-sdk-3.1.101-linux-arm.tar.gz
# check binary is was not manipulated (checksum test)
dotnetName="dotnet-sdk-2.1.607-linux-arm.tar.gz"
binaryChecksum="2cd8fa250e6a0e81faf409e7dc4f6d581117f565d58cff48b31f457e7cafc7f3cfe0de0df2b1c5d035733879750eb2af22fcc950720a7a7192e4221318052838"
dotnetName="dotnet-sdk-3.1.101-linux-arm.tar.gz"
binaryChecksum="bd68786e16d59b18096658ccab2a662f35cd047065a6c87a9c6790a893a580a6aa81b1338360087e58d5b5e5fdca08269936281e41a7a7e7051667efb738a613"
actualChecksum=$(sha512sum /home/btcpay/${dotnetName} | cut -d " " -f1)
if [ "${actualChecksum}" != "${binaryChecksum}" ]; then
echo "!!! FAIL !!! Downloaded ${dotnetName} not matching SHA512 checksum: ${binaryChecksum}"
@@ -75,10 +72,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
# download aspnetcore-runtime
sudo -u btcpay wget https://download.visualstudio.microsoft.com/download/pr/9c563df7-736b-49ce-bd17-e739f3765541/e93dd1eff909e59a7ba72784a64dc031/aspnetcore-runtime-2.1.14-linux-arm.tar.gz
sudo -u btcpay wget https://download.visualstudio.microsoft.com/download/pr/da60c9fc-c329-42d6-afaf-b8ef2bbadcf3/14655b5928319349e78da3327874592a/aspnetcore-runtime-3.1.1-linux-arm.tar.gz
# check binary is was not manipulated (checksum test)
aspnetcoreName="aspnetcore-runtime-2.1.14-linux-arm.tar.gz"
binaryChecksum="f4500187bf135254a03b5eb4105b8ce20f71d71e0f08c2c2ec914920f80435b7b36351c3f9c15504d0b1c2187b904c8283db67a2b60ebff374b058641153aaac"
aspnetcoreName="aspnetcore-runtime-3.1.1-linux-arm.tar.gz"
binaryChecksum="5171cdd232f02fbd41abee893ebe3722fe442436bef9792fec9c687a746357d22b4499aa6f0a9e35285bc04783c54e400810acb365c5a1c3401f23a65e6b062f"
actualChecksum=$(sha512sum /home/btcpay/${aspnetcoreName} | cut -d " " -f1)
if [ "${actualChecksum}" != "${binaryChecksum}" ]; then
echo "!!! FAIL !!! Downloaded ${aspnetcoreName} not matching SHA512 checksum: ${binaryChecksum}"
@@ -93,24 +90,38 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# opt out of telemetry
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | sudo tee -a /etc/environment
sudo ln -s /home/btcpay/dotnet/dotnet /usr/local/bin
# make .NET accessible and add to PATH
sudo ln -s /home/btcpay/dotnet /usr/share
export PATH=$PATH:/usr/share
if [ $(cat /etc/profile | grep -c "/usr/share") -eq 0 ]; then
sudo bash -c "echo 'PATH=\$PATH:/usr/share' >> /etc/profile"
fi
export DOTNET_ROOT=/home/btcpay/dotnet
export PATH=$PATH:/home/btcpay/dotnet
if [ $(cat /etc/profile | grep -c "DOTNET_ROOT") -eq 0 ]; then
sudo bash -c "echo 'DOTNET_ROOT=/home/btcpay/dotnet' >> /etc/profile"
sudo bash -c "echo 'PATH=\$PATH:/home/btcpay/dotnet' >> /etc/profile"
fi
sudo -u btcpay /home/btcpay/dotnet/dotnet --info
# NBXplorer
echo ""
echo "***"
echo "Installing NBXplorer"
echo "Install NBXplorer"
echo "***"
echo ""
cd /home/btcpay
sudo -u btcpay git clone https://github.com/dgarage/NBXplorer.git
echo "Downloading NBXplorer source code.."
sudo -u btcpay git clone https://github.com/dgarage/NBXplorer.git 2>/dev/null
cd NBXplorer
# checkout from last known to work commit:
# https://github.com/dgarage/NBXplorer/commit/6069d0a06aae467cab41ea509450222d45fb9c04
# check https://github.com/dgarage/NBXplorer/commits/master
sudo -u btcpay git checkout 6069d0a06aae467cab41ea509450222d45fb9c04
sudo -u btcpay ./build.sh
# check https://github.com/dgarage/NBXplorer/releases
sudo -u btcpay git reset --hard v2.1.7
# from the build.sh with path
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj
# create nbxplorer service
echo "
[Unit]
Description=NBXplorer daemon
@@ -118,7 +129,7 @@ Requires=bitcoind.service
After=bitcoind.service
[Service]
ExecStart=/usr/local/bin/dotnet \"/home/btcpay/NBXplorer/NBXplorer/bin/Release/netcoreapp2.1/NBXplorer.dll\" -c /home/btcpay/.nbxplorer/Main/settings.config
ExecStart=/home/btcpay/dotnet/dotnet \"/home/btcpay/NBXplorer/NBXplorer/bin/Release/netcoreapp3.1/NBXplorer.dll\" -c /home/btcpay/.nbxplorer/Main/settings.config
User=btcpay
Group=btcpay
Type=simple
@@ -135,8 +146,7 @@ WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/nbxplorer.service
sudo systemctl daemon-reload
# restart to create settings.config if was running already
sudo systemctl restart nbxplorer
# start to create settings.config
sudo systemctl enable nbxplorer
sudo systemctl start nbxplorer
@@ -157,8 +167,6 @@ WantedBy=multi-user.target
echo "getting RPC credentials from the bitcoin.conf"
RPC_USER=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-)
PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
#sudo mv /home/btcpay/.nbxplorer/Main/settings.config /home/admin/settings.config
#sudo chown admin:admin /home/admin/settings.config
sudo mv /home/btcpay/.nbxplorer/Main/settings.config /home/btcpay/.nbxplorer/Main/settings.config.backup
touch /home/admin/settings.config
sudo chmod 600 /home/admin/settings.config || exit 1
@@ -171,20 +179,23 @@ EOF
sudo chown btcpay:btcpay /home/btcpay/.nbxplorer/Main/settings.config
sudo systemctl restart nbxplorer
# BTCPayServer
echo ""
echo "***"
echo "Installing BTCPayServer"
echo "Install BTCPayServer"
echo "***"
echo ""
cd /home/btcpay
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git
echo "Downloading BTCPayServer source code.."
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git 2>/dev/null
cd btcpayserver
# https://github.com/btcpayserver/btcpayserver/releases
sudo -u btcpay git reset --hard v1.0.3.150
# sudo -u btcpay ./build.sh
sudo -u btcpay dotnet build -c Release BTCPayServer/BTCPayServer.csproj
# check https://github.com/btcpayserver/btcpayserver/releases
sudo -u btcpay git reset --hard v1.0.3.153
# from the build.sh with path
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj
# create btcpayserver service
echo "
[Unit]
Description=BtcPayServer daemon
@@ -192,7 +203,7 @@ Requires=btcpayserver.service
After=nbxplorer.service
[Service]
ExecStart=/usr/local/bin/dotnet run --no-launch-profile --no-build -c Release -p \"/home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj\" -- \$@
ExecStart=/home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release -p \"/home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj\" -- \$@
User=btcpay
Group=btcpay
Type=simple
@@ -207,6 +218,18 @@ WantedBy=multi-user.target
sudo systemctl enable btcpayserver
sudo systemctl start btcpayserver
echo "Checking for btcpayserver config"
while [ ! -f "/home/btcpay/.btcpayserver/Main/settings.config" ]
do
echo "Waiting for btcpayserver to start - CTRL+C to abort"
sleep 10
hasFailed=$(sudo systemctl status btcpayserver | grep -c "Active: failed")
if [ ${hasFailed} -eq 1 ]; then
echo "seems like starting btcpayserver service has failed - see: systemctl status btcpayserver"
echo "maybe report here: https://github.com/rootzoll/raspiblitz/issues/214"
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
@@ -248,17 +271,18 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
isInstalled=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
if [ ${isInstalled} -eq 1 ]; then
echo "*** REMOVING BTCPAYSERVER ***"
echo "*** REMOVING BTCPAYSERVER, NBXPLORER and .NET ***"
sudo systemctl stop btcpayserver
sudo systemctl disable btcpayserver
sudo rm /etc/systemd/system/btcpayserver.service
sudo -u btcpay dotnet nuget locals all --clear
sudo rm -rf /tmp/NuGetScratch
sudo rm -f /home/btcpay/dotnet-sdk*
sudo rm -f /home/btcpay/aspnetcore*
sudo rm -rf /home/btcpay/dotnet
sudo rm -f /usr/local/bin/dotnet
sudo rm -rf /usr/share/dotnet
sudo systemctl stop nbxplorer 2>/dev/null
sudo systemctl disable nbxplorer 2>/dev/null

View File

@@ -6,7 +6,7 @@ echo "installing Nginx"
echo "***"
echo ""
sudo apt-get install -y nginx
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx start 2>/dev/null
# Only generate if there is none. Or Electrum will not connect if the cert changed.
if [ -f /etc/ssl/certs/localhost.crt ] ; then