Add update menu for electrs v0.9.9 (#3402)

Add UPDATE - ELECTRS menu entry

Add update method to script with update to the latest release tag.
This commit is contained in:
ChuckNorrison 2022-11-04 15:50:54 +01:00 committed by GitHub
parent 3b0fdc5117
commit f93b04fe1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -476,6 +476,10 @@ if [ "${bos}" == "on" ]; then
OPTIONS+=(BOS "Update Balance of Satoshis")
fi
if [ "${ElectRS}" == "on" ]; then
OPTIONS+=(ELECTRS "Update Electrs")
fi
if [ "${RTL}" == "on" ]||[ "${cRTL}" == "on" ]; then
OPTIONS+=(RTL "Update RTL")
fi
@ -547,6 +551,9 @@ case $CHOICE in
BOS)
/home/admin/config.scripts/bonus.bos.sh update
;;
ELECTRS)
/home/admin/config.scripts/bonus.electrs.sh update
;;
RTL)
/home/admin/config.scripts/bonus.rtl.sh update
;;

View File

@ -10,7 +10,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to switch the Electrum Rust Server on or off"
echo "bonus.electrs.sh status -> dont call in loops"
echo "bonus.electrs.sh status-sync"
echo "bonus.electrs.sh [on|off|menu]"
echo "bonus.electrs.sh [on|off|menu|update]"
echo "installs the version $ELECTRSVERSION"
exit 1
fi
@ -510,5 +510,28 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
exit 0
fi
if [ "$1" = "update" ]; then
echo "# Update Electrs"
cd /home/electrs/electrs || exit 1
sudo -u electrs git fetch
localVersion=$(git describe --tag)
updateVersion=$(curl -s https://api.github.com/repos/romanz/electrs/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
if [ $localVersion = $updateVersion ]; then
echo "# Up-to-date on version $localVersion"
else
echo "# Pulling latest changes..."
sudo -u electrs git pull -p
echo "# Reset to the latest release tag: $updateVersion"
sudo -u electrs git reset --hard $updateVersion
echo "# Build Electrs ..."
sudo -u electrs /home/electrs/.cargo/bin/cargo build --locked --release || exit 1
echo "# Updated Electrs to $updateVersion"
fi
sudo systemctl start electrs
exit 0
fi
echo "# FAIL - Unknown Parameter $1"
exit 1