mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-11 13:20:56 +02:00
Add mempool to update menu (#2147)
This commit is contained in:
parent
7c88367ae2
commit
b2f1f138e9
@ -320,6 +320,9 @@ if [ "${runBehindTor}" == "on" ]; then
|
||||
HEIGHT=$((HEIGHT+1))
|
||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
||||
fi
|
||||
if [ "${mempoolExplorer}" == "on" ]; then
|
||||
OPTIONS+=(MEMPOOL "Update Mempool Explorer")
|
||||
fi
|
||||
|
||||
CHOICE=$(dialog --clear \
|
||||
--backtitle "" \
|
||||
@ -362,4 +365,7 @@ case $CHOICE in
|
||||
TOR)
|
||||
sudo /home/admin/config.scripts/internet.tor.sh update
|
||||
;;
|
||||
MEMPOOL)
|
||||
/home/admin/config.scripts/bonus.mempool.sh update
|
||||
;;
|
||||
esac
|
||||
|
@ -334,5 +334,89 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# update
|
||||
if [ "$1" = "update" ]; then
|
||||
echo "*** Checking Mempool Explorer Version ***"
|
||||
|
||||
cd /home/mempool/mempool
|
||||
|
||||
localVersion=$(git describe --tag)
|
||||
updateVersion=$(curl -s https://api.github.com/repos/mempool/mempool/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
|
||||
|
||||
if [ $localVersion = $updateVersion ]; then
|
||||
echo "*** You are up-to-date on version $localVersion ***"
|
||||
sudo systemctl restart mempool 2>/dev/null
|
||||
echo "*** Restarting Mempool ***"
|
||||
else
|
||||
# Preserve Config
|
||||
sudo cp backend/mempool-config.json /home/admin
|
||||
|
||||
sudo -u mempool git checkout $updateVersion
|
||||
|
||||
echo "# npm install for mempool explorer (backend)"
|
||||
|
||||
cd /home/mempool/mempool/backend/
|
||||
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm install
|
||||
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"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# npm install for mempool explorer (frontend)"
|
||||
|
||||
cd ../frontend
|
||||
sudo -u mempool NG_CLI_ANALYTICS=false npm install
|
||||
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"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo mv /home/admin/mempool-config.json /home/mempool/mempool/backend/mempool-config.json
|
||||
sudo chown mempool:mempool /home/mempool/mempool/backend/mempool-config.json
|
||||
|
||||
|
||||
# Restore frontend files
|
||||
cd /home/mempool/mempool/frontend
|
||||
sudo rsync -I -av --delete dist/mempool/ /var/www/mempool/
|
||||
sudo chown -R www-data:www-data /var/www/mempool
|
||||
|
||||
cd /home/mempool/mempool
|
||||
|
||||
# Reinstall the mempool configuration for nginx
|
||||
cp nginx.conf nginx-mempool.conf /etc/nginx/nginx.conf
|
||||
sudo systemctl restart nginx
|
||||
|
||||
# Remove useless deps
|
||||
echo "Removing unneccesary modules..."
|
||||
npm prune --production
|
||||
|
||||
|
||||
echo "*** Restarting Mempool ***"
|
||||
sudo systemctl start mempool
|
||||
|
||||
fi
|
||||
|
||||
# check for error
|
||||
isDead=$(sudo systemctl status mempool | grep -c 'inactive (dead)')
|
||||
if [ ${isDead} -eq 1 ]; then
|
||||
echo "error='Mempool service start failed'"
|
||||
exit 1
|
||||
else
|
||||
echo "*** Mempool version ${updateVersion} now running ***"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "error='unknown parameter'
|
||||
exit 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user