mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-19 20:24:39 +02:00
sphinxrelay: fix update option (#1810)
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
# command info
|
# command info
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "config script to switch Sphinx-Relay on/off"
|
echo "config script to switch Sphinx-Relay on,off or update"
|
||||||
echo "bonus.sphinxrelay.sh on [?GITHUBUSER] [?BRANCH]"
|
echo "bonus.sphinxrelay.sh on [?GITHUBUSER] [?BRANCH]"
|
||||||
echo "bonus.sphinxrelay.sh [off|status|menu|write-environment|update]"
|
echo "bonus.sphinxrelay.sh [off|status|menu|write-environment|update]"
|
||||||
echo "# DEVELOPMENT: TO SYNC WITH YOUR FORKED GITHUB-REPO"
|
echo "# DEVELOPMENT: TO SYNC WITH YOUR FORKED GITHUB-REPO"
|
||||||
@@ -419,32 +419,28 @@ fi
|
|||||||
|
|
||||||
# update
|
# update
|
||||||
if [ "$1" = "update" ]; then
|
if [ "$1" = "update" ]; then
|
||||||
echo "# UPDATING SPHINX"
|
echo "# Updating Sphinx-Relay"
|
||||||
sudo systemctl stop sphinxrelay
|
cd /home/sphinxrelay/sphinx-relay/
|
||||||
cd /home/sphinxrelay/sphinx-relay
|
# https://github.com/stakwork/sphinx-relay/blob/master/docs/raspiblitz_deployment.md#fast-method
|
||||||
# fetch latest master
|
echo "# Stashing the config"
|
||||||
sudo -u sphinxrelay git fetch
|
if [ $(sudo -u sphinxrelay git stash|grep -c "Please tell me who you are") -gt 0 ]; then
|
||||||
# unset $1
|
git config user.email "you@example.com"
|
||||||
set --
|
git config user.name "Your Name"
|
||||||
UPSTREAM=${1:-'@{u}'}
|
|
||||||
LOCAL=$(git rev-parse @)
|
|
||||||
REMOTE=$(git rev-parse "$UPSTREAM")
|
|
||||||
if [ $LOCAL = $REMOTE ]; then
|
|
||||||
TAG=$(git tag | sort -V | tail -1)
|
|
||||||
echo "# You are up-to-date on version" $TAG
|
|
||||||
else
|
|
||||||
echo "# Pulling latest changes..."
|
|
||||||
sudo -u sphinxrelay git pull -p
|
|
||||||
echo "# Reset to the latest release tag"
|
|
||||||
TAG=$(git tag | sort -V | tail -1)
|
|
||||||
sudo -u sphinxrelay git reset --hard $TAG
|
|
||||||
sudo -u sphinxrelay npm install
|
|
||||||
echo "# Updated to version" $TAG
|
|
||||||
fi
|
fi
|
||||||
|
sudo -u sphinxrelay git stash
|
||||||
echo "# Updated to the latest in https://github.com/stakwork/sphinx-relay/releases"
|
echo "# Pulling latest changes..."
|
||||||
echo ""
|
sudo -u sphinxrelay git checkout master || exit 1
|
||||||
echo "# Starting the sphinxrelay service ... "
|
sudo -u sphinxrelay git pull || exit 1
|
||||||
|
echo "# Reset to the latest release tag"
|
||||||
|
TAG=$(git tag | sort -V | tail -1)
|
||||||
|
sudo -u sphinxrelay git reset --hard $TAG || exit 1
|
||||||
|
echo "# Reapplying the config"
|
||||||
|
sudo -u sphinxrelay git stash pop
|
||||||
|
echo "# Installing NPM dependencies"
|
||||||
|
sudo -u sphinxrelay npm install
|
||||||
|
echo "# Updated to version" $TAG
|
||||||
|
echo
|
||||||
|
echo "# Starting the sphinxrelay.service ... "
|
||||||
sudo systemctl start sphinxrelay
|
sudo systemctl start sphinxrelay
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user