mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-23 14:40:45 +01:00
Fatpack WebUI Apps (#3514)
This commit is contained in:
parent
6c9bfaf1b7
commit
fb9283a06c
8 changed files with 657 additions and 427 deletions
|
@ -787,9 +787,21 @@ if ${fatpack}; then
|
|||
# Fallback Nodes List from Bitcoin Core
|
||||
sudo -u admin curl https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_main.txt -o /home/admin/fallback.bitcoin.nodes
|
||||
|
||||
echo "* Adding Code&Compile for WEBUI-APP: RTL"
|
||||
/home/admin/config.scripts/bonus.rtl.sh install || exit 1
|
||||
echo "* Adding Code&Compile for WEBUI-APP: BTCPAYSERVER"
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh install || exit 1
|
||||
echo "* Adding Code&Compile for WEBUI-APP: MEMPOOL"
|
||||
/home/admin/config.scripts/bonus.mempool.sh install || exit 1
|
||||
echo "* Adding Code&Compile for WEBUI-APP: THUNDERHUB"
|
||||
/home/admin/config.scripts/bonus.thunderhub.sh install || exit 1
|
||||
echo "* Adding Code&Compile for WEBUI-APP: BTC RPC EXPLORER"
|
||||
/home/admin/config.scripts/bonus.btc-rpc-explorer.sh install || exit 1
|
||||
echo "* Adding Code&Compile for WEBUI-APP: LNBITS"
|
||||
/home/admin/config.scripts/bonus.lnbits.sh install || exit 1
|
||||
|
||||
echo "* Adding Raspiblitz API ..."
|
||||
sudo /home/admin/config.scripts/blitz.web.api.sh on || exit 1
|
||||
|
||||
echo "* Adding Raspiblitz WebUI ..."
|
||||
sudo /home/admin/config.scripts/blitz.web.ui.sh on || exit 1
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "# small config script to switch BTC-RPC-explorer on or off"
|
||||
echo "# bonus.btc-rpc-explorer.sh [install|uninstall]"
|
||||
echo "# bonus.btc-rpc-explorer.sh [status|on|off]"
|
||||
echo "# bonus.btc-rpc-explorer.sh prestart"
|
||||
exit 1
|
||||
|
@ -182,44 +183,84 @@ if [ "$1" = "prestart" ]; then
|
|||
exit 0 # exit with clean code
|
||||
fi
|
||||
|
||||
|
||||
# stop service (for all calls below)
|
||||
echo "# making sure services are not running"
|
||||
sudo systemctl stop btc-rpc-explorer 2>/dev/null
|
||||
|
||||
# install (code & compile)
|
||||
if [ "$1" = "install" ]; then
|
||||
|
||||
# check if already installed
|
||||
isInstalled=$(compgen -u | grep -c btcrpcexplorer)
|
||||
if [ "${isInstalled}" != "0" ]; then
|
||||
echo "result='already installed'"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "# *** INSTALL BTC-RPC-EXPLORER ***"
|
||||
|
||||
# install nodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
|
||||
# add btcrpcexplorer user
|
||||
sudo adduser --disabled-password --gecos "" btcrpcexplorer
|
||||
|
||||
# install btc-rpc-explorer
|
||||
cd /home/btcrpcexplorer
|
||||
sudo -u btcrpcexplorer git clone https://github.com/janoside/btc-rpc-explorer.git
|
||||
cd btc-rpc-explorer
|
||||
sudo -u btcrpcexplorer git reset --hard v3.3.0
|
||||
sudo -u btcrpcexplorer /home/admin/config.scripts/blitz.git-verify.sh "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
sudo -u btcrpcexplorer npm install
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm install did not run correctly, aborting"
|
||||
echo "result='fail npm install'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# remove from system
|
||||
if [ "$1" = "uninstall" ]; then
|
||||
|
||||
# check if still active
|
||||
isActive=$(sudo ls /etc/systemd/system/btc-rpc-explorer.service 2>/dev/null | grep -c 'btc-rpc-explorer.service')
|
||||
if [ "${isActive}" != "0" ]; then
|
||||
echo "result='still in use'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# *** UNINSTALL BTC-RPC-EXPLORER ***"
|
||||
|
||||
# always delete user and home directory
|
||||
sudo userdel -rf btcrpcexplorer
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##########################
|
||||
# ON
|
||||
#########################
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "# *** INSTALL BTC-RPC-EXPLORER ***"
|
||||
|
||||
# check if code is already installed
|
||||
isInstalled=$(compgen -u | grep -c btcrpcexplorer)
|
||||
if [ "${isInstalled}" == "0" ]; then
|
||||
echo "# Installing code base & dependencies first .."
|
||||
/home/admin/config.scripts/bonus.btc-rpc-explorer.sh install || exit 1
|
||||
fi
|
||||
|
||||
echo "# *** ACTIVATE BTC-RPC-EXPLORER ***"
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/btc-rpc-explorer.service 2>/dev/null | grep -c 'btc-rpc-explorer.service')
|
||||
if [ ${isInstalled} -eq 0 ]; then
|
||||
|
||||
# install nodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
|
||||
# make sure that txindex of blockchain is switched on
|
||||
/home/admin/config.scripts/network.txindex.sh on
|
||||
|
||||
# add btcrpcexplorer user
|
||||
sudo adduser --disabled-password --gecos "" btcrpcexplorer
|
||||
|
||||
# install btc-rpc-explorer
|
||||
cd /home/btcrpcexplorer
|
||||
sudo -u btcrpcexplorer git clone https://github.com/janoside/btc-rpc-explorer.git
|
||||
cd btc-rpc-explorer
|
||||
sudo -u btcrpcexplorer git reset --hard v3.3.0
|
||||
sudo -u btcrpcexplorer /home/admin/config.scripts/blitz.git-verify.sh \
|
||||
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
sudo -u btcrpcexplorer npm install
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm install did not run correctly, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# prepare .env file
|
||||
echo "# getting RPC credentials from the ${network}.conf"
|
||||
|
||||
|
@ -270,7 +311,6 @@ EOF
|
|||
sudo ufw allow 3021 comment 'btc-rpc-explorer HTTPS'
|
||||
echo ""
|
||||
|
||||
|
||||
##################
|
||||
# NGINX
|
||||
##################
|
||||
|
@ -372,8 +412,6 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
echo "# *** REMOVING BTC-RPC-explorer ***"
|
||||
sudo systemctl disable btc-rpc-explorer
|
||||
sudo rm /etc/systemd/system/btc-rpc-explorer.service
|
||||
# delete user and home directory
|
||||
sudo userdel -rf btcrpcexplorer
|
||||
|
||||
# remove nginx symlinks
|
||||
sudo rm -f /etc/nginx/sites-enabled/btcrpcexplorer_ssl.conf
|
||||
|
|
|
@ -11,6 +11,7 @@ BTCPayVersion="v1.7.1"
|
|||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "Config script to switch BTCPay Server on or off"
|
||||
echo "Usage:"
|
||||
echo "bonus.btcpayserver.sh [install|uninstall]"
|
||||
echo "bonus.btcpayserver.sh [on|off|menu|write-tls-macaroon|cln-lightning-rpc-access]"
|
||||
echo "installs BTCPayServer $BTCPayVersion with NBXplorer $NBXplorerVersion"
|
||||
echo "To update to the latest release published on github run:"
|
||||
|
@ -26,8 +27,6 @@ source <(/home/admin/_cache.sh get state)
|
|||
|
||||
function postgresConfig() {
|
||||
|
||||
sudo /home/admin/config.scripts/bonus.postgresql.sh on || exit 1
|
||||
|
||||
echo "# Generate the database"
|
||||
sudo -u postgres psql -c "create database nbxplorermainnet;"
|
||||
sudo -u postgres psql -c "create user nbxplorer with encrypted password 'raspiblitz';"
|
||||
|
@ -95,12 +94,13 @@ explorer.postgres=User ID=nbxplorer;Host=localhost;Port=5432;Application Name=nb
|
|||
|
||||
if [ "$1" = "status" ]; then
|
||||
|
||||
isInstalled=$(compgen -u | grep -c btcpay)
|
||||
echo "prepared=${isInstalled}"
|
||||
isActive=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
|
||||
echo "installed=${isActive}"
|
||||
|
||||
if [ "${BTCPayServer}" = "on" ]; then
|
||||
|
||||
echo "switchedon=1"
|
||||
isInstalled=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
|
||||
echo "installed=${isInstalled}"
|
||||
|
||||
localIP=$(hostname -I | awk '{print $1}')
|
||||
echo "localIP='${localIP}'"
|
||||
echo "httpPort='23000'"
|
||||
|
@ -112,7 +112,7 @@ if [ "$1" = "status" ]; then
|
|||
|
||||
# check for LetsEncryptDomain for DynDns
|
||||
error=""
|
||||
source <(sudo /home/admin/config.scripts/blitz.subscriptions.ip2tor.py ip-by-tor $publicIP)
|
||||
source <(sudo /home/admin/config.scripts/blitz.subscriptions.ip2tor.py ip-by-tor $publicIP 2>/dev/null)
|
||||
if [ ${#error} -eq 0 ]; then
|
||||
echo "publicDomain='${domain}'"
|
||||
fi
|
||||
|
@ -154,7 +154,6 @@ if [ "$1" = "status" ]; then
|
|||
|
||||
else
|
||||
echo "switchedon=0"
|
||||
echo "installed=0"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
@ -290,13 +289,143 @@ type=clightning;server=unix:///home/bitcoin/.lightning/bitcoin/lightning-rpc
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "# INSTALL BTCPAYSERVER"
|
||||
########################################
|
||||
# INSTALL (just user, code & compile)
|
||||
########################################
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
|
||||
# check if code is already installed
|
||||
isInstalled=$(compgen -u | grep -c btcpay)
|
||||
if [ "${isInstalled}" != "0" ]; then
|
||||
echo "# already installed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "# create btcpay user"
|
||||
sudo adduser --disabled-password --gecos "" btcpay
|
||||
cd /home/btcpay || exit 1
|
||||
|
||||
echo "# install .NET"
|
||||
# https://dotnet.microsoft.com/en-us/download/dotnet/6.0
|
||||
sudo apt-get -y install libunwind8 gettext libssl1.0
|
||||
cpu=$(uname -m)
|
||||
if [ "${cpu}" = "aarch64" ]; then
|
||||
binaryVersion="arm64"
|
||||
dotNetdirectLink="https://download.visualstudio.microsoft.com/download/pr/d43345e2-f0d7-4866-b56e-419071f30ebe/68debcece0276e9b25a65ec5798cf07b/dotnet-sdk-6.0.101-linux-arm64.tar.gz"
|
||||
dotNetChecksum="04cd89279f412ae6b11170d1724c6ac42bb5d4fae8352020a1f28511086dd6d6af2106dd48ebe3b39d312a21ee8925115de51979687a9161819a3a29e270a954"
|
||||
elif [ "${cpu}" = "x86_64" ]; then
|
||||
binaryVersion="x64"
|
||||
dotNetdirectLink="https://download.visualstudio.microsoft.com/download/pr/ede8a287-3d61-4988-a356-32ff9129079e/bdb47b6b510ed0c4f0b132f7f4ad9d5a/dotnet-sdk-6.0.101-linux-x64.tar.gz"
|
||||
dotNetChecksum="ca21345400bcaceadad6327345f5364e858059cfcbc1759f05d7df7701fec26f1ead297b6928afa01e46db6f84e50770c673146a10b9ff71e4c7f7bc76fbf709"
|
||||
else
|
||||
echo "# FAIL! CPU (${cpu}) not supported."
|
||||
echo "result='dotnet cpu not supported'"
|
||||
exit 1
|
||||
fi
|
||||
dotNetName="dotnet-sdk-6.0.101-linux-${binaryVersion}.tar.gz"
|
||||
sudo rm /home/btcpay/${dotnetName} 2>/dev/null
|
||||
sudo -u btcpay wget "${dotNetdirectLink}" -O "${dotNetName}"
|
||||
# check binary is was not manipulated (checksum test)
|
||||
actualChecksum=$(sha512sum /home/btcpay/${dotNetName} | cut -d " " -f1)
|
||||
if [ "${actualChecksum}" != "${dotNetChecksum}" ]; then
|
||||
echo "# FAIL # Downloaded ${dotNetName} not matching SHA512 checksum: ${dotNetChecksum}"
|
||||
echo "result='dotnet wrong checksum'"
|
||||
exit 1
|
||||
fi
|
||||
sudo -u btcpay mkdir /home/btcpay/dotnet
|
||||
sudo -u btcpay tar -xvf ${dotNetName} -C /home/btcpay/dotnet
|
||||
sudo rm -f *.tar.gz*
|
||||
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | sudo tee -a /etc/environment
|
||||
|
||||
# NBXplorer
|
||||
echo "# Install NBXplorer"
|
||||
cd /home/btcpay || exit 1
|
||||
echo "# Download the NBXplorer source code ..."
|
||||
sudo -u btcpay git clone https://github.com/dgarage/NBXplorer.git 2>/dev/null
|
||||
cd NBXplorer || exit 1
|
||||
sudo -u btcpay git reset --hard $NBXplorerVersion
|
||||
# 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 "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
echo "# Build NBXplorer ..."
|
||||
# from the build.sh with path
|
||||
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj
|
||||
|
||||
# BTCPayServer
|
||||
echo "# Install BTCPayServer"
|
||||
cd /home/btcpay || exit 1
|
||||
echo "# Download the BTCPayServer source code ..."
|
||||
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git 2>/dev/null
|
||||
cd btcpayserver || exit 1
|
||||
sudo -u btcpay git reset --hard $BTCPayVersion
|
||||
#sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh "web-flow" "https://github.com/web-flow.gpg" "4AEE18F83AFDEB23" || exit 1
|
||||
PGPsigner="nicolasdorier"
|
||||
PGPpubkeyLink="https://keybase.io/nicolasdorier/pgp_keys.asc"
|
||||
PGPpubkeyFingerprint="AB4CFA9895ACA0DBE27F6B346618763EF09186FE"
|
||||
#PGPsigner="Kukks"
|
||||
#PGPpubkeyLink="https://github.com/${PGPsigner}.gpg"
|
||||
#PGPpubkeyFingerprint="8E5530D9D1C93097"
|
||||
sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
|
||||
echo "# Build BTCPayServer ..."
|
||||
# from the build.sh with path
|
||||
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
########################################
|
||||
# UNINSTALL (remove from system)
|
||||
########################################
|
||||
|
||||
if [ "$1" = "uninstall" ]; then
|
||||
|
||||
isActive=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
|
||||
if [ "${isActive}" != "0" ]; then
|
||||
echo "# cannot uninstall if still 'on'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# clear dotnet cache
|
||||
/home/btcpay/dotnet/dotnet nuget locals all --clear
|
||||
|
||||
# remove dotnet
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
|
||||
# nuke user
|
||||
sudo userdel -rf btcpay 2>/dev/null
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
########################################
|
||||
# ON (activate & config)
|
||||
########################################
|
||||
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# check if already active
|
||||
isActive=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
|
||||
if [ "${isActive}" != "0" ]; then
|
||||
echo "result='already active'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if code is already installed
|
||||
isInstalled=$(compgen -u | grep -c btcpay)
|
||||
if [ "${isInstalled}" == "0" ]; then
|
||||
echo "# Installing code base & dependencies first .."
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh install || exit 1
|
||||
fi
|
||||
|
||||
echo "# ACTIVATE BTCPAYSERVER"
|
||||
|
||||
echo "# install postreSQL"
|
||||
sudo /home/admin/config.scripts/bonus.postgresql.sh on || exit 1
|
||||
|
||||
##################
|
||||
# NGINX
|
||||
##################
|
||||
# setup nginx symlinks
|
||||
if ! [ -f /etc/nginx/sites-available/btcpay_ssl.conf ]; then
|
||||
sudo cp /home/admin/assets/nginx/sites-available/btcpay_ssl.conf /etc/nginx/sites-available/btcpay_ssl.conf
|
||||
|
@ -327,117 +456,36 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
|
||||
# check for $BTCPayDomain
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
if [ "${BTCPayDomain}" == "off" ]; then
|
||||
BTCPayDomain=""
|
||||
fi
|
||||
|
||||
# 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
|
||||
sudo adduser --disabled-password --gecos "" btcpay
|
||||
cd /home/btcpay || exit 1
|
||||
cd /home/btcpay || exit 1
|
||||
|
||||
# store BTCpay data on HDD
|
||||
sudo mkdir /mnt/hdd/app-data/.btcpayserver 2>/dev/null
|
||||
# store BTCpay data on HDD
|
||||
sudo mkdir /mnt/hdd/app-data/.btcpayserver 2>/dev/null
|
||||
|
||||
# move old btcpay data to app-data
|
||||
sudo mv -f /mnt/hdd/.btcpayserver/* /mnt/hdd/app-data/.btcpayserver/ 2>/dev/null
|
||||
sudo rm -rf /mnt/hdd/.btcpayserver 2>/dev/null
|
||||
# move old btcpay data to app-data
|
||||
sudo mv -f /mnt/hdd/.btcpayserver/* /mnt/hdd/app-data/.btcpayserver/ 2>/dev/null
|
||||
sudo rm -rf /mnt/hdd/.btcpayserver 2>/dev/null
|
||||
|
||||
sudo chown -R btcpay:btcpay /mnt/hdd/app-data/.btcpayserver
|
||||
sudo ln -s /mnt/hdd/app-data/.btcpayserver /home/btcpay/ 2>/dev/null
|
||||
sudo chown -R btcpay:btcpay /home/btcpay/.btcpayserver
|
||||
sudo chown -R btcpay:btcpay /mnt/hdd/app-data/.btcpayserver
|
||||
sudo ln -s /mnt/hdd/app-data/.btcpayserver /home/btcpay/ 2>/dev/null
|
||||
sudo chown -R btcpay:btcpay /home/btcpay/.btcpayserver
|
||||
|
||||
# POSTGRES
|
||||
postgresConfig
|
||||
|
||||
# .NET
|
||||
echo
|
||||
echo "# Installing .NET"
|
||||
echo
|
||||
# https://dotnet.microsoft.com/en-us/download/dotnet/6.0
|
||||
# dependencies
|
||||
sudo apt-get -y install libunwind8 gettext libssl1.0
|
||||
|
||||
cpu=$(uname -m)
|
||||
if [ "${cpu}" = "aarch64" ]; then
|
||||
binaryVersion="arm64"
|
||||
dotNetdirectLink="https://download.visualstudio.microsoft.com/download/pr/d43345e2-f0d7-4866-b56e-419071f30ebe/68debcece0276e9b25a65ec5798cf07b/dotnet-sdk-6.0.101-linux-arm64.tar.gz"
|
||||
dotNetChecksum="04cd89279f412ae6b11170d1724c6ac42bb5d4fae8352020a1f28511086dd6d6af2106dd48ebe3b39d312a21ee8925115de51979687a9161819a3a29e270a954"
|
||||
#dotNetdirectLink="https://download.visualstudio.microsoft.com/download/pr/d3aaa7cc-a603-4693-871b-53b1537a4319/5981099ca17a113b3ce1c080462c50ef/dotnet-sdk-3.1.416-linux-arm64.tar.gz"
|
||||
#dotNetChecksum="0065c7afb129b1a0e0c11703309f3b45cf9a3c0ea156247f7cc61555f21c37054f215eb77add509dad77b1d388a4e6c585f8a8016109f31c5b64184b25e2c407"
|
||||
elif [ "${cpu}" = "x86_64" ]; then
|
||||
binaryVersion="x64"
|
||||
dotNetdirectLink="https://download.visualstudio.microsoft.com/download/pr/ede8a287-3d61-4988-a356-32ff9129079e/bdb47b6b510ed0c4f0b132f7f4ad9d5a/dotnet-sdk-6.0.101-linux-x64.tar.gz"
|
||||
dotNetChecksum="ca21345400bcaceadad6327345f5364e858059cfcbc1759f05d7df7701fec26f1ead297b6928afa01e46db6f84e50770c673146a10b9ff71e4c7f7bc76fbf709"
|
||||
#dotNetdirectLink="https://download.visualstudio.microsoft.com/download/pr/3c98126b-50f5-4497-8ffd-18d17a3f6b95/044d0f20256fd9bf2971f8da9a0364e4/dotnet-sdk-3.1.416-linux-x64.tar.gz"
|
||||
#dotNetChecksum="dec1dcf326487031c45dec0849a046a0d034d6cbb43ab591da6d94c2faf72da8e31deeaf4d2165049181546d5296bb874a039ccc2f618cf95e68a26399da5e7f"
|
||||
else
|
||||
echo "# FAIL! CPU (${cpu}) not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dotNetName="dotnet-sdk-6.0.101-linux-${binaryVersion}.tar.gz"
|
||||
sudo rm /home/btcpay/${dotnetName} 2>/dev/null
|
||||
sudo -u btcpay wget "${dotNetdirectLink}" -O "${dotNetName}"
|
||||
# check binary is was not manipulated (checksum test)
|
||||
actualChecksum=$(sha512sum /home/btcpay/${dotNetName} | cut -d " " -f1)
|
||||
if [ "${actualChecksum}" != "${dotNetChecksum}" ]; then
|
||||
echo "# FAIL # Downloaded ${dotNetName} not matching SHA512 checksum: ${dotNetChecksum}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo -u btcpay mkdir /home/btcpay/dotnet
|
||||
sudo -u btcpay tar -xvf ${dotNetName} -C /home/btcpay/dotnet
|
||||
sudo rm -f *.tar.gz*
|
||||
|
||||
# opt out of telemetry
|
||||
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | sudo tee -a /etc/environment
|
||||
|
||||
# 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 "# Install NBXplorer"
|
||||
echo
|
||||
cd /home/btcpay || exit 1
|
||||
echo "# Download the NBXplorer source code ..."
|
||||
sudo -u btcpay git clone https://github.com/dgarage/NBXplorer.git 2>/dev/null
|
||||
cd NBXplorer || exit 1
|
||||
sudo -u btcpay git reset --hard $NBXplorerVersion
|
||||
# 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 \
|
||||
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
echo "# Build NBXplorer ..."
|
||||
# from the build.sh with path
|
||||
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj
|
||||
## see the configuration options with:
|
||||
# sudo -u btcpay /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release --project "NBXplorer/NBXplorer.csproj" -c /home/btcpay/.nbxplorer/Main/settings.config -h
|
||||
##sudo systenmct run manually to debug:
|
||||
# sudo su - btcpay
|
||||
# cd NBXplorer
|
||||
# /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release --project "NBXplorer/NBXplorer.csproj" -- $@
|
||||
echo "# create the nbxplorer.service"
|
||||
echo "
|
||||
## see the configuration options with:
|
||||
# sudo -u btcpay /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release --project "NBXplorer/NBXplorer.csproj" -c /home/btcpay/.nbxplorer/Main/settings.config -h
|
||||
##sudo systenmct run manually to debug:
|
||||
# sudo su - btcpay
|
||||
# cd NBXplorer
|
||||
# /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release --project "NBXplorer/NBXplorer.csproj" -- $@
|
||||
echo "# create the nbxplorer.service"
|
||||
echo "
|
||||
[Unit]
|
||||
Description=NBXplorer daemon
|
||||
Requires=bitcoind.service
|
||||
|
@ -464,76 +512,52 @@ PrivateDevices=true
|
|||
WantedBy=multi-user.target
|
||||
" | sudo tee /etc/systemd/system/nbxplorer.service
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
# start to create settings.config
|
||||
sudo systemctl enable nbxplorer
|
||||
sudo systemctl daemon-reload
|
||||
# start to create settings.config
|
||||
sudo systemctl enable nbxplorer
|
||||
|
||||
if [ "${state}" == "ready" ]; then
|
||||
echo "# Starting nbxplorer"
|
||||
sudo systemctl start nbxplorer
|
||||
echo "# Checking for nbxplorer config"
|
||||
while [ ! -f "/home/btcpay/.nbxplorer/Main/settings.config" ]
|
||||
do
|
||||
echo "# Waiting for nbxplorer to start - CTRL+C to abort"
|
||||
sleep 10
|
||||
hasFailed=$(sudo systemctl status nbxplorer | grep -c "Active: failed")
|
||||
if [ ${hasFailed} -eq 1 ]; then
|
||||
echo "# seems like starting nbxplorer service has failed - see: systemctl status nbxplorer"
|
||||
echo "# maybe report here: https://github.com/rootzoll/raspiblitz/issues/214"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "# Because the system is not 'ready' the service 'nbxplorer' will not be started at this point .. its enabled and will start on next reboot"
|
||||
if [ "${state}" == "ready" ]; then
|
||||
echo "# Starting nbxplorer"
|
||||
sudo systemctl start nbxplorer
|
||||
echo "# Checking for nbxplorer config"
|
||||
while [ ! -f "/home/btcpay/.nbxplorer/Main/settings.config" ]
|
||||
do
|
||||
echo "# Waiting for nbxplorer to start - CTRL+C to abort"
|
||||
sleep 10
|
||||
hasFailed=$(sudo systemctl status nbxplorer | grep -c "Active: failed")
|
||||
if [ ${hasFailed} -eq 1 ]; then
|
||||
echo "# seems like starting nbxplorer service has failed - see: systemctl status nbxplorer"
|
||||
echo "# maybe report here: https://github.com/rootzoll/raspiblitz/issues/214"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "# Because the system is not 'ready' the service 'nbxplorer' will not be started at this point .. its enabled and will start on next reboot"
|
||||
fi
|
||||
|
||||
postgresConfig
|
||||
|
||||
NBXplorerConfig
|
||||
|
||||
# whitelist localhost in bitcoind
|
||||
if ! sudo grep -Eq "^whitelist=127.0.0.1" /mnt/hdd/bitcoin/bitcoin.conf;then
|
||||
echo "whitelist=127.0.0.1" | sudo tee -a /mnt/hdd/bitcoin/bitcoin.conf
|
||||
bitcoindRestart=yes
|
||||
fi
|
||||
|
||||
if [ "${state}" == "ready" ]; then
|
||||
if [ "${bitcoindRestart}" == "yes" ]; then
|
||||
echo "# Restarting bitcoind"
|
||||
sudo systemctl restart bitcoind
|
||||
fi
|
||||
sudo systemctl restart nbxplorer
|
||||
fi
|
||||
|
||||
NBXplorerConfig
|
||||
|
||||
# whitelist localhost in bitcoind
|
||||
if ! sudo grep -Eq "^whitelist=127.0.0.1" /mnt/hdd/bitcoin/bitcoin.conf;then
|
||||
echo "whitelist=127.0.0.1" | sudo tee -a /mnt/hdd/bitcoin/bitcoin.conf
|
||||
bitcoindRestart=yes
|
||||
fi
|
||||
|
||||
if [ "${state}" == "ready" ]; then
|
||||
if [ "${bitcoindRestart}" == "yes" ]; then
|
||||
echo "# Restarting bitcoind"
|
||||
sudo systemctl restart bitcoind
|
||||
fi
|
||||
sudo systemctl restart nbxplorer
|
||||
fi
|
||||
|
||||
# BTCPayServer
|
||||
echo
|
||||
echo "# Install BTCPayServer"
|
||||
echo
|
||||
cd /home/btcpay || exit 1
|
||||
echo "# Download the BTCPayServer source code ..."
|
||||
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git 2>/dev/null
|
||||
cd btcpayserver || exit 1
|
||||
sudo -u btcpay git reset --hard $BTCPayVersion
|
||||
|
||||
#sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
|
||||
# "web-flow" "https://github.com/web-flow.gpg" "4AEE18F83AFDEB23" || exit 1
|
||||
|
||||
PGPsigner="nicolasdorier"
|
||||
PGPpubkeyLink="https://keybase.io/nicolasdorier/pgp_keys.asc"
|
||||
PGPpubkeyFingerprint="AB4CFA9895ACA0DBE27F6B346618763EF09186FE"
|
||||
#PGPsigner="Kukks"
|
||||
#PGPpubkeyLink="https://github.com/${PGPsigner}.gpg"
|
||||
#PGPpubkeyFingerprint="8E5530D9D1C93097"
|
||||
sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh \
|
||||
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
|
||||
echo "# Build BTCPayServer ..."
|
||||
# from the build.sh with path
|
||||
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj
|
||||
|
||||
# see the configuration options with:
|
||||
# sudo -u btcpay /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release -p "/home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj" -- -h
|
||||
# run manually to debug:
|
||||
# sudo -u btcpay /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release --project "/home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj" -- --sqlitefile=sqllite.db
|
||||
echo "# create the btcpayserver.service"
|
||||
echo "
|
||||
# see the configuration options with:
|
||||
# sudo -u btcpay /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release -p "/home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj" -- -h
|
||||
# run manually to debug:
|
||||
# sudo -u btcpay /home/btcpay/dotnet/dotnet run --no-launch-profile --no-build -c Release --project "/home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj" -- --sqlitefile=sqllite.db
|
||||
echo "# create the btcpayserver.service"
|
||||
echo "
|
||||
[Unit]
|
||||
Description=BtcPayServer daemon
|
||||
Requires=nbxplorer.service
|
||||
|
@ -560,38 +584,29 @@ WantedBy=multi-user.target
|
|||
" | sudo tee /etc/systemd/system/btcpayserver.service
|
||||
sudo systemctl enable btcpayserver
|
||||
|
||||
if [ "${state}" == "ready" ]; then
|
||||
echo "# Starting 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 30
|
||||
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
|
||||
else
|
||||
echo "# Because the system is not 'ready' the service 'btcpayserver' will not be started at this point .. its enabled and will start on next reboot"
|
||||
fi
|
||||
|
||||
sudo -u btcpay mkdir -p /home/btcpay/.btcpayserver/Main/
|
||||
if [ "${lnd}" = on ]; then
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh write-tls-macaroon
|
||||
fi
|
||||
if [ "${cl}" = on ]; then
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh cln-lightning-rpc-access
|
||||
fi
|
||||
if [ "${state}" == "ready" ]; then
|
||||
echo "# Starting 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 30
|
||||
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
|
||||
else
|
||||
echo "# BTCPay Server is already installed."
|
||||
if [ "${state}" == "ready" ]; then
|
||||
# start service
|
||||
echo "# start service"
|
||||
sudo systemctl start nbxplorer 2>/dev/null
|
||||
sudo systemctl start btcpayserver 2>/dev/null
|
||||
fi
|
||||
echo "# Because the system is not 'ready' the service 'btcpayserver' will not be started at this point .. its enabled and will start on next reboot"
|
||||
fi
|
||||
|
||||
sudo -u btcpay mkdir -p /home/btcpay/.btcpayserver/Main/
|
||||
if [ "${lnd}" = on ]; then
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh write-tls-macaroon
|
||||
fi
|
||||
if [ "${cl}" = on ]; then
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh cln-lightning-rpc-access
|
||||
fi
|
||||
|
||||
# setting value in raspi blitz config
|
||||
|
@ -602,7 +617,10 @@ WantedBy=multi-user.target
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# switch off
|
||||
########################################
|
||||
# OFF (deactivate)
|
||||
########################################
|
||||
|
||||
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
|
||||
# check for second parameter: should data be deleted?
|
||||
|
@ -628,33 +646,24 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
/home/admin/config.scripts/tor.onion-service.sh off btcpay
|
||||
fi
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
|
||||
if [ ${isInstalled} -eq 1 ]; then
|
||||
echo "# *** REMOVING BTCPAYSERVER, NBXPLORER and .NET ***"
|
||||
# removing services
|
||||
# btcpay
|
||||
sudo systemctl stop btcpayserver
|
||||
sudo systemctl disable btcpayserver
|
||||
sudo rm /etc/systemd/system/btcpayserver.service
|
||||
else
|
||||
echo "# The btcpayserver.service is not installed."
|
||||
fi
|
||||
# removing service: btcpay
|
||||
sudo systemctl stop btcpayserver
|
||||
sudo systemctl disable btcpayserver
|
||||
sudo rm /etc/systemd/system/btcpayserver.service
|
||||
|
||||
# nbxplorer
|
||||
# removing service: nbxplorer
|
||||
sudo systemctl stop nbxplorer
|
||||
sudo systemctl disable nbxplorer
|
||||
sudo rm /etc/systemd/system/nbxplorer.service
|
||||
# clear dotnet cache
|
||||
/home/btcpay/dotnet/dotnet nuget locals all --clear
|
||||
sudo rm -rf /tmp/NuGetScratch
|
||||
# remove dotnet
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
|
||||
# clear app config (not user data)
|
||||
sudo rm -f /home/btcpay/.nbxplorer/Main/settings.config
|
||||
sudo rm -f /home/btcpay/.btcpayserver/Main/settings.config
|
||||
|
||||
# clear nginx config (from btcpaysetdomain)
|
||||
sudo rm -f /etc/nginx/sites-enabled/btcpayserver
|
||||
sudo rm -f /etc/nginx/sites-available/btcpayserver
|
||||
|
||||
# remove nginx symlinks
|
||||
sudo rm -f /etc/nginx/sites-enabled/btcpay_ssl.conf
|
||||
sudo rm -f /etc/nginx/sites-enabled/btcpay_tor.conf
|
||||
|
@ -664,8 +673,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
sudo rm -f /etc/nginx/sites-available/btcpay_tor_ssl.conf
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
# nuke user
|
||||
sudo userdel -rf btcpay 2>/dev/null
|
||||
|
||||
if [ ${deleteData} -eq 1 ]; then
|
||||
echo "# deleting data"
|
||||
sudo -u postgres psql -c "drop database nbxplorermainnet;"
|
||||
|
@ -674,7 +682,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
else
|
||||
echo "# keeping data"
|
||||
fi
|
||||
echo "# OK BTCPayServer removed."
|
||||
echo "# OK BTCPayServer deactivaed."
|
||||
|
||||
# needed for API/WebUI as signal that install ran thru
|
||||
echo "result='OK'"
|
||||
|
|
|
@ -10,7 +10,8 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|||
echo "Config script to switch LNbits on or off."
|
||||
echo "Installs the version ${tag} by default."
|
||||
echo "Usage:"
|
||||
echo "bonus.lnbits.sh on [lnd|tlnd|slnd|cl|tcl|scl] [?GITHUBUSER] [?BRANCH|?TAG]"
|
||||
echo "bonus.lnbits.sh [install|uninstall] [?GITHUBUSER] [?BRANCH|?TAG]"
|
||||
echo "bonus.lnbits.sh on [lnd|tlnd|slnd|cl|tcl|scl]"
|
||||
echo "bonus.lnbits.sh switch [lnd|tlnd|slnd|cl|tcl|scl]"
|
||||
echo "bonus.lnbits.sh off"
|
||||
echo "bonus.lnbits.sh status"
|
||||
|
@ -526,12 +527,89 @@ fi
|
|||
# stop service
|
||||
sudo systemctl stop lnbits 2>/dev/null
|
||||
|
||||
# install (code & compile)
|
||||
if [ "$1" = "install" ]; then
|
||||
|
||||
# check if already installed
|
||||
isInstalled=$(compgen -u | grep -c lnbits)
|
||||
if [ "${isInstalled}" != "0" ]; then
|
||||
echo "result='already installed'"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "# *** INSTALL THUNDERHUB ***"
|
||||
|
||||
# add lnbits user
|
||||
echo "*** Add the 'lnbits' user ***"
|
||||
sudo adduser --disabled-password --gecos "" lnbits
|
||||
|
||||
# get optional github parameter
|
||||
githubUser="lnbits"
|
||||
if [ "$2" != "" ]; then
|
||||
githubUser="$2"
|
||||
fi
|
||||
if [ "$3" != "" ]; then
|
||||
tag="$3"
|
||||
fi
|
||||
|
||||
# install from GitHub
|
||||
echo "# get the github code user(${githubUser}) branch(${tag})"
|
||||
sudo rm -r /home/lnbits/lnbits 2>/dev/null
|
||||
cd /home/lnbits || exit 1
|
||||
sudo -u lnbits git clone https://github.com/${githubUser}/lnbits-legend lnbits
|
||||
cd /home/lnbits/lnbits || exit 1
|
||||
sudo -u lnbits git checkout ${tag} || exit 1
|
||||
|
||||
# to the install
|
||||
echo "# installing application dependencies"
|
||||
cd /home/lnbits/lnbits || exit 1
|
||||
|
||||
# do install like this
|
||||
sudo -u lnbits python3 -m venv venv
|
||||
sudo -u lnbits ./venv/bin/pip install -r requirements.txt
|
||||
sudo -u lnbits ./venv/bin/pip install pylightning
|
||||
sudo -u lnbits ./venv/bin/pip install secp256k1
|
||||
sudo -u lnbits ./venv/bin/pip install pyln-client
|
||||
sudo -u lnbits ./venv/bin/pip install psycopg2 # conv.py postgres migration dependency
|
||||
|
||||
# build
|
||||
sudo -u lnbits ./venv/bin/python build.py
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# remove from system
|
||||
if [ "$1" = "uninstall" ]; then
|
||||
|
||||
# check if still active
|
||||
isActive=$(sudo ls /etc/systemd/system/lnbits.service 2>/dev/null | grep -c 'lnbits.service')
|
||||
if [ "${isActive}" != "0" ]; then
|
||||
echo "result='still in use'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# *** UNINSTALL LNBITS ***"
|
||||
|
||||
# always delete user and home directory
|
||||
sudo userdel -rf lnbits
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# install
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# check if already installed
|
||||
isInstalled=$(sudo ls /etc/systemd/system/lnbits.service 2>/dev/null | grep -c 'lnbits.service')
|
||||
if [ "${isInstalled}" == "1" ]; then
|
||||
# check if code is already installed
|
||||
isInstalled=$(compgen -u | grep -c lnbits)
|
||||
if [ "${isInstalled}" == "0" ]; then
|
||||
echo "# Installing code base & dependencies first .."
|
||||
/home/admin/config.scripts/bonus.lnbits.sh install || exit 1
|
||||
fi
|
||||
|
||||
# check if already active
|
||||
isActive=$(sudo ls /etc/systemd/system/lnbits.service 2>/dev/null | grep -c 'lnbits.service')
|
||||
if [ "${isActive}" == "1" ]; then
|
||||
echo "# FAIL: already installed"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -586,27 +664,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# add lnbits user
|
||||
echo "*** Add the 'lnbits' user ***"
|
||||
sudo adduser --disabled-password --gecos "" lnbits
|
||||
|
||||
# get optional github parameter
|
||||
githubUser="lnbits"
|
||||
if [ "$3" != "" ]; then
|
||||
githubUser="$3"
|
||||
fi
|
||||
if [ "$4" != "" ]; then
|
||||
tag="$4"
|
||||
fi
|
||||
|
||||
# install from GitHub
|
||||
echo "# get the github code user(${githubUser}) branch(${tag})"
|
||||
sudo rm -r /home/lnbits/lnbits 2>/dev/null
|
||||
cd /home/lnbits || exit 1
|
||||
sudo -u lnbits git clone https://github.com/${githubUser}/lnbits-legend lnbits
|
||||
cd /home/lnbits/lnbits || exit 1
|
||||
sudo -u lnbits git checkout ${tag} || exit 1
|
||||
|
||||
# prepare .env file
|
||||
echo "# preparing env file"
|
||||
sudo rm /home/lnbits/lnbits/.env 2>/dev/null
|
||||
|
@ -639,22 +696,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
|
||||
# let switch command part do the detail config
|
||||
/home/admin/config.scripts/bonus.lnbits.sh switch ${fundingsource}
|
||||
|
||||
# to the install
|
||||
echo "# installing application dependencies"
|
||||
cd /home/lnbits/lnbits || exit 1
|
||||
|
||||
# do install like this
|
||||
sudo -u lnbits python3 -m venv venv
|
||||
sudo -u lnbits ./venv/bin/pip install -r requirements.txt
|
||||
sudo -u lnbits ./venv/bin/pip install pylightning
|
||||
sudo -u lnbits ./venv/bin/pip install secp256k1
|
||||
sudo -u lnbits ./venv/bin/pip install pyln-client
|
||||
sudo -u lnbits ./venv/bin/pip install psycopg2 # conv.py postgres migration dependency
|
||||
|
||||
# build
|
||||
sudo -u lnbits ./venv/bin/python build.py
|
||||
|
||||
# open firewall
|
||||
echo
|
||||
echo "*** Updating Firewall ***"
|
||||
|
@ -905,9 +948,6 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
/home/admin/config.scripts/tor.onion-service.sh off lnbits
|
||||
fi
|
||||
|
||||
# always clean
|
||||
sudo userdel -rf lnbits
|
||||
|
||||
if [ ${deleteData} -eq 1 ]; then
|
||||
echo "# deleting data"
|
||||
sudo -u postgres psql -c "drop database lnbits_db;"
|
||||
|
|
|
@ -8,6 +8,7 @@ pinnedVersion="v2.4.0"
|
|||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "# small config script to switch Mempool on or off"
|
||||
echo "# installs the $pinnedVersion by default"
|
||||
echo "# bonus.mempool.sh [install|uninstall]"
|
||||
echo "# bonus.mempool.sh [status|on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -65,6 +66,9 @@ fi
|
|||
# status
|
||||
if [ "$1" = "status" ]; then
|
||||
|
||||
isInstalled=$(compgen -u | grep -c mempool)
|
||||
echo "codebase=${isInstalled}"
|
||||
|
||||
if [ "${mempoolExplorer}" = "on" ]; then
|
||||
echo "configured=1"
|
||||
|
||||
|
@ -96,7 +100,7 @@ if [ "$1" = "status" ]; then
|
|||
fi
|
||||
|
||||
else
|
||||
echo "installed=0"
|
||||
echo "active=0"
|
||||
echo "configured=0"
|
||||
fi
|
||||
exit 0
|
||||
|
@ -106,37 +110,102 @@ fi
|
|||
echo "# making sure services are not running"
|
||||
sudo systemctl stop mempool 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
# install (code & compile)
|
||||
if [ "$1" = "install" ]; then
|
||||
|
||||
# check if already installed
|
||||
isInstalled=$(compgen -u | grep -c mempool)
|
||||
if [ "${isInstalled}" != "0" ]; then
|
||||
echo "result='already installed'"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "# *** INSTALL MEMPOOL ***"
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/mempool.service 2>/dev/null | grep -c 'mempool.service')
|
||||
if [ ${isInstalled} -eq 0 ]; then
|
||||
# install nodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
|
||||
# install nodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
# make sure needed os dependencies are installed
|
||||
sudo apt-get install -y mariadb-server mariadb-client
|
||||
|
||||
# add mempool user
|
||||
sudo adduser --disabled-password --gecos "" mempool
|
||||
|
||||
# install mempool
|
||||
cd /home/mempool
|
||||
sudo -u mempool git clone https://github.com/mempool/mempool.git
|
||||
cd mempool
|
||||
sudo -u mempool git reset --hard $pinnedVersion
|
||||
sudo -u mempool /home/admin/config.scripts/blitz.git-verify.sh "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
|
||||
echo "# npm install for mempool explorer (frontend)"
|
||||
|
||||
cd frontend
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm install --no-optional
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm install did not run correctly, aborting"
|
||||
exit 1
|
||||
fi
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm run build
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm run build did not run correctly, aborting (1)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# npm install for mempool explorer (backend)"
|
||||
|
||||
cd ../backend/
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm install --no-optional
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "# FAIL - npm install did not run correctly, aborting"
|
||||
echo "result='failed npm install'"
|
||||
exit 1
|
||||
fi
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm run build
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "# FAIL - npm run build did not run correctly, aborting (2)"
|
||||
echo "result='failed npm run build'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# remove from system
|
||||
if [ "$1" = "uninstall" ]; then
|
||||
|
||||
# check if still active
|
||||
isActive=$(sudo ls /etc/systemd/system/mempool.service 2>/dev/null | grep -c 'mempool.service')
|
||||
if [ "${isActive}" != "0" ]; then
|
||||
echo "result='still in use'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# *** UNINSTALL MEMPOOL ***"
|
||||
|
||||
# always delete user and home directory
|
||||
sudo userdel -rf mempool
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
isInstalled=$(compgen -u | grep -c mempool)
|
||||
if [ "${isInstalled}" == "0" ]; then
|
||||
echo "# Install code base first ...."
|
||||
/home/admin/config.scripts/bonus.mempool.sh install
|
||||
fi
|
||||
|
||||
echo "# *** Activate MEMPOOL ***"
|
||||
|
||||
isActive=$(sudo ls /etc/systemd/system/mempool.service 2>/dev/null | grep -c 'mempool.service')
|
||||
if [ ${isActive} -eq 0 ]; then
|
||||
|
||||
# make sure that txindex of blockchain is switched on
|
||||
/home/admin/config.scripts/network.txindex.sh on
|
||||
|
||||
# make sure needed os dependencies are installed
|
||||
sudo apt-get install -y mariadb-server mariadb-client
|
||||
|
||||
# add mempool user
|
||||
sudo adduser --disabled-password --gecos "" mempool
|
||||
|
||||
# install mempool
|
||||
cd /home/mempool
|
||||
sudo -u mempool git clone https://github.com/mempool/mempool.git
|
||||
cd mempool
|
||||
sudo -u mempool git reset --hard $pinnedVersion
|
||||
sudo -u mempool /home/admin/config.scripts/blitz.git-verify.sh \
|
||||
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
|
||||
# modify an
|
||||
#echo "# try to suppress question on statistics report .."
|
||||
#sudo sed -i "s/^}/,\"cli\": {\"analytics\": false}}/g" /home/mempool/mempool/frontend/angular.json
|
||||
|
||||
sudo mariadb -e "DROP DATABASE IF EXISTS mempool;"
|
||||
sudo mariadb -e "CREATE DATABASE mempool;"
|
||||
sudo mariadb -e "GRANT ALL PRIVILEGES ON mempool.* TO 'mempool' IDENTIFIED BY 'mempool';"
|
||||
|
@ -145,34 +214,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
mariadb -umempool -pmempool mempool < mariadb-structure.sql
|
||||
fi
|
||||
|
||||
echo "# npm install for mempool explorer (frontend)"
|
||||
|
||||
cd frontend
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm install --no-optional
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm install did not run correctly, aborting"
|
||||
exit 1
|
||||
fi
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm run build
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm run build did not run correctly, aborting (1)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# npm install for mempool explorer (backend)"
|
||||
|
||||
cd ../backend/
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm install --no-optional
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm install did not run correctly, aborting"
|
||||
exit 1
|
||||
fi
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm run build
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "FAIL - npm run build did not run correctly, aborting (2)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# prepare .env file
|
||||
echo "# getting RPC credentials from the ${network}.conf"
|
||||
|
||||
|
@ -233,7 +274,6 @@ EOF
|
|||
sudo ufw allow 4081 comment 'mempool HTTPS'
|
||||
echo ""
|
||||
|
||||
|
||||
##################
|
||||
# NGINX
|
||||
##################
|
||||
|
@ -330,9 +370,6 @@ fi
|
|||
# switch off
|
||||
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
|
||||
# always delete user and home directory
|
||||
sudo userdel -rf mempool
|
||||
|
||||
# always remove nginx symlinks
|
||||
sudo rm -f /etc/nginx/snippets/mempool.conf
|
||||
sudo rm -f /etc/nginx/snippets/mempool-http.conf
|
||||
|
|
|
@ -9,6 +9,7 @@ fi
|
|||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# https://github.com/rootzoll/raspiblitz/issues/3218
|
||||
echo "# Install PostgreSQL"
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|||
echo "# config script for RideTheLightning $RTLVERSION WebInterface"
|
||||
echo "# able to run intances for lnd and cl parallel"
|
||||
echo "# mainnet and testnet instances can run parallel"
|
||||
echo "# bonus.rtl.sh [install|uninstall]"
|
||||
echo "# bonus.rtl.sh [on|off|menu] <lnd|cl> <mainnet|testnet|signet> <purge>"
|
||||
echo "# bonus.rtl.sh connect-services"
|
||||
echo "# bonus.rtl.sh prestart <lnd|cl> <mainnet|testnet|signet>"
|
||||
|
@ -114,6 +115,97 @@ Activate Tor to access the web interface from outside your local network.
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
########################################
|
||||
# INSTALL (just user, code & compile)
|
||||
########################################
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
|
||||
# check if already installed
|
||||
if [ -f /home/rtl/RTL/LICENSE ];then
|
||||
echo "# RTL already installed - skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "# Installing RTL codebase"
|
||||
|
||||
# check and install NodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
|
||||
# create rtl user (one for all instances)
|
||||
if [ $(compgen -u | grep -c rtl) -eq 0 ];then
|
||||
sudo adduser --disabled-password --gecos "" rtl || exit 1
|
||||
fi
|
||||
|
||||
# download source code and set to tag release
|
||||
echo "# Get the RTL Source Code"
|
||||
sudo -u rtl rm -rf /home/rtl/RTL 2>/dev/null
|
||||
sudo -u rtl git clone https://github.com/ShahanaFarooqui/RTL.git /home/rtl/RTL
|
||||
cd /home/rtl/RTL
|
||||
# check https://github.com/Ride-The-Lightning/RTL/releases/
|
||||
sudo -u rtl git reset --hard $RTLVERSION
|
||||
|
||||
sudo -u rtl /home/admin/config.scripts/blitz.git-verify.sh "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${RTLVERSION}" || exit 1
|
||||
|
||||
# from https://github.com/Ride-The-Lightning/RTL/commits/master
|
||||
# git checkout 917feebfa4fb583360c140e817c266649307ef72
|
||||
if [ -f /home/rtl/RTL/LICENSE ]; then
|
||||
echo "# OK - RTL code copy looks good"
|
||||
else
|
||||
echo "# FAIL - RTL code not available"
|
||||
echo "err='code download falied'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install
|
||||
echo "# Running npm install ..."
|
||||
export NG_CLI_ANALYTICS=false
|
||||
sudo -u rtl npm install --omit=dev
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "# FAIL - npm install did not run correctly - deleting code and exit"
|
||||
sudo rm -r /home/rtl/RTL
|
||||
exit 1
|
||||
else
|
||||
echo "# OK - RTL install looks good"
|
||||
echo
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
########################################
|
||||
# UNINSTALL (remove from system)
|
||||
########################################
|
||||
|
||||
if [ "$1" = "uninstall" ]; then
|
||||
|
||||
echo "# Uninstalling RTL codebase"
|
||||
|
||||
# check LND RTL services
|
||||
isActiveMain=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
isActiveTest=$(sudo ls /etc/systemd/system/tRTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
isActiveSig=$(sudo ls /etc/systemd/system/sRTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
if [ "${isActiveMain}" != "0" ] || [ "${isActiveTest}" != "0" ] || [ "${isActiveSig}" != "0" ]; then
|
||||
echo "# cannot uninstall RTL still used by LND"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check LND RTL services
|
||||
isActiveMain=$(sudo ls /etc/systemd/system/cRTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
isActiveTest=$(sudo ls /etc/systemd/system/tcRTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
isActiveSig=$(sudo ls /etc/systemd/system/scRTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
if [ "${isActiveMain}" != "0" ] || [ "${isActiveTest}" != "0" ] || [ "${isActiveSig}" != "0" ]; then
|
||||
echo "# cannot uninstall RTL still used by CLN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# Delete user and home directory"
|
||||
sudo userdel -rf rtl
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##########################
|
||||
# ON
|
||||
#########################
|
||||
|
@ -126,72 +218,37 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# check that is installed
|
||||
isInstalled=$(sudo ls /etc/systemd/system/${systemdService}.service 2>/dev/null | grep -c "${systemdService}.service")
|
||||
if [ ${isInstalled} -eq 1 ]; then
|
||||
echo "# OK, the ${netprefix}${typeprefix}RTL.service is already installed."
|
||||
# check that is already active
|
||||
isActive=$(sudo ls /etc/systemd/system/${systemdService}.service 2>/dev/null | grep -c "${systemdService}.service")
|
||||
if [ ${isActive} -eq 1 ]; then
|
||||
echo "# OK, the ${netprefix}${typeprefix}RTL.service is already active."
|
||||
echo "result='already active'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# Installing RTL for ${LNTYPE} ${CHAIN}"
|
||||
|
||||
# check and install NodeJS
|
||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||
|
||||
# create rtl user (one for all instances)
|
||||
if [ $(compgen -u | grep -c rtl) -eq 0 ];then
|
||||
sudo adduser --disabled-password --gecos "" rtl || exit 1
|
||||
# make sure softwarte is installed
|
||||
if [ -f /home/rtl/RTL/LICENSE ];then
|
||||
echo "# OK - the RTL code is already present"
|
||||
else
|
||||
echo "# install of codebase is needed first"
|
||||
/home/admin/config.scripts/bonus.rtl.sh install || exit 1
|
||||
fi
|
||||
cd /home/rtl/RTL
|
||||
|
||||
echo "# Activating RTL for ${LNTYPE} ${CHAIN}"
|
||||
|
||||
echo "# Make sure symlink to central app-data directory exists"
|
||||
if ! [[ -L "/home/rtl/.lnd" ]]; then
|
||||
sudo rm -rf "/home/rtl/.lnd" 2>/dev/null # not a symlink.. delete it silently
|
||||
sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/rtl/.lnd" # and create symlink
|
||||
fi
|
||||
|
||||
if [ "${LNTYPE}" == "lnd" ]; then
|
||||
# for LND make sure user rtl is allowed to access admin macaroons
|
||||
echo "# adding user rtl to group lndadmin"
|
||||
sudo /usr/sbin/usermod --append --groups lndadmin rtl
|
||||
fi
|
||||
|
||||
# source code (one place for all instances)
|
||||
if [ -f /home/rtl/RTL/LICENSE ];then
|
||||
echo "# OK - the RTL code is already present"
|
||||
cd /home/rtl/RTL
|
||||
else
|
||||
# download source code and set to tag release
|
||||
echo "# Get the RTL Source Code"
|
||||
sudo -u rtl rm -rf /home/rtl/RTL 2>/dev/null
|
||||
sudo -u rtl git clone https://github.com/ShahanaFarooqui/RTL.git /home/rtl/RTL
|
||||
cd /home/rtl/RTL
|
||||
# check https://github.com/Ride-The-Lightning/RTL/releases/
|
||||
sudo -u rtl git reset --hard $RTLVERSION
|
||||
|
||||
sudo -u rtl /home/admin/config.scripts/blitz.git-verify.sh \
|
||||
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${RTLVERSION}" || exit 1
|
||||
|
||||
# from https://github.com/Ride-The-Lightning/RTL/commits/master
|
||||
# git checkout 917feebfa4fb583360c140e817c266649307ef72
|
||||
if [ -f /home/rtl/RTL/LICENSE ]; then
|
||||
echo "# OK - RTL code copy looks good"
|
||||
else
|
||||
echo "# FAIL - RTL code not available"
|
||||
echo "err='code download falied'"
|
||||
exit 1
|
||||
fi
|
||||
# install
|
||||
echo "# Running npm install ..."
|
||||
export NG_CLI_ANALYTICS=false
|
||||
sudo -u rtl npm install --omit=dev
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "# FAIL - npm install did not run correctly - deleting code and exit"
|
||||
sudo rm -r /home/rtl/RTL
|
||||
exit 1
|
||||
else
|
||||
echo "# OK - RTL install looks good"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "# Updating Firewall"
|
||||
sudo ufw allow ${RTLHTTP} comment "${systemdService} HTTP"
|
||||
sudo ufw allow $((RTLHTTP+1)) comment "${systemdService} HTTPS"
|
||||
|
@ -488,9 +545,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
|
||||
# only if 'purge' is an additional parameter (other instances/services might need this)
|
||||
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
|
||||
echo "# Removing the binaries"
|
||||
echo "# Delete user and home directory"
|
||||
sudo userdel -rf rtl
|
||||
home/admin/config.scripts/bonus.rtl.sh uninstall
|
||||
if [ $LNTYPE = cl ];then
|
||||
/home/admin/config.scripts/cl.rest.sh off ${CHAIN}
|
||||
fi
|
||||
|
|
|
@ -6,6 +6,7 @@ THUBVERSION="v0.13.16"
|
|||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "config script to install, update or uninstall ThunderHub"
|
||||
echo "bonus.thunderhub.sh [install|uninstall]"
|
||||
echo "bonus.thunderhub.sh [on|off|menu|update|status]"
|
||||
echo "install $THUBVERSION by default"
|
||||
exit 1
|
||||
|
@ -76,17 +77,18 @@ fi
|
|||
echo "making sure services are not running"
|
||||
sudo systemctl stop thunderhub 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "*** INSTALL THUNDERHUB ***"
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/thunderhub.service 2>/dev/null | grep -c 'thunderhub.service')
|
||||
if ! [ ${isInstalled} -eq 0 ]; then
|
||||
echo "ThunderHub already installed."
|
||||
else
|
||||
###############
|
||||
# INSTALL
|
||||
###############
|
||||
# install (code & compile)
|
||||
if [ "$1" = "install" ]; then
|
||||
|
||||
# check if already installed
|
||||
isInstalled=$(compgen -u | grep -c thunderhub)
|
||||
if [ "${isInstalled}" != "0" ]; then
|
||||
echo "result='already installed'"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "# *** INSTALL THUNDERHUB ***"
|
||||
|
||||
# Preparations
|
||||
# check and install NodeJS
|
||||
|
@ -101,13 +103,13 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
# https://github.com/apotdevin/thunderhub/releases
|
||||
sudo -u thunderhub git reset --hard $THUBVERSION
|
||||
|
||||
sudo -u thunderhub /home/admin/config.scripts/blitz.git-verify.sh \
|
||||
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
sudo -u thunderhub /home/admin/config.scripts/blitz.git-verify.sh "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
|
||||
|
||||
echo "Running npm install ..."
|
||||
sudo rm -r /home/thunderhub/thunderhub/node_modules 2>/dev/null
|
||||
if ! sudo -u thunderhub npm install; then
|
||||
echo "FAIL - npm install did not run correctly, aborting"
|
||||
echo "result='fail npm install '"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -117,6 +119,44 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
echo "# run build ..."
|
||||
sudo -u thunderhub npm run build
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# remove from system
|
||||
if [ "$1" = "uninstall" ]; then
|
||||
|
||||
# check if still active
|
||||
isActive=$(sudo ls /etc/systemd/system/thunderhub.service 2>/dev/null | grep -c 'thunderhub.service')
|
||||
if [ "${isActive}" != "0" ]; then
|
||||
echo "result='still in use'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# *** UNINSTALL THUNDERHUB ***"
|
||||
|
||||
# always delete user and home directory
|
||||
sudo userdel -rf thunderhub
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# check if code is already installed
|
||||
isInstalled=$(compgen -u | grep -c thunderhub)
|
||||
if [ "${isInstalled}" == "0" ]; then
|
||||
echo "# Installing code base & dependencies first .."
|
||||
/home/admin/config.scripts/bonus.thunderhub.sh install || exit 1
|
||||
fi
|
||||
|
||||
echo "*** INSTALL THUNDERHUB ***"
|
||||
|
||||
isActive=$(sudo ls /etc/systemd/system/thunderhub.service 2>/dev/null | grep -c 'thunderhub.service')
|
||||
if ! [ ${isActive} -eq 0 ]; then
|
||||
echo "ThunderHub already installed."
|
||||
else
|
||||
|
||||
###############
|
||||
# CONFIG
|
||||
###############
|
||||
|
@ -293,8 +333,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
# remove systemd service
|
||||
sudo systemctl disable thunderhub
|
||||
sudo rm -f /etc/systemd/system/thunderhub.service
|
||||
# delete user and home directory
|
||||
sudo userdel -rf thunderhub
|
||||
|
||||
# close ports on firewall
|
||||
sudo ufw deny 3010
|
||||
sudo ufw deny 3011
|
||||
|
@ -314,7 +353,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
/home/admin/config.scripts/tor.onion-service.sh off thunderhub
|
||||
fi
|
||||
|
||||
echo "OK ThunderHub removed."
|
||||
echo "OK ThunderHub deactivated"
|
||||
|
||||
# disable balance sharing server side
|
||||
/home/admin/config.scripts/blitz.conf.sh set DISABLE_BALANCE_PUSHES true /mnt/hdd/app-data/thunderhub/.env.local noquotes
|
||||
|
|
Loading…
Add table
Reference in a new issue