diff --git a/home.admin/99updateMenu.sh b/home.admin/99updateMenu.sh index 4193e1914..c780c5760 100755 --- a/home.admin/99updateMenu.sh +++ b/home.admin/99updateMenu.sh @@ -291,6 +291,9 @@ fi if [ "${specter}" == "on" ]; then OPTIONS+=(SPECTER "Update Cryptoadvance Specter") fi +if [ "${rtlWebinterface}" == "on" ]; then + OPTIONS+=(RTL "Update RTL") +fi CHOICE=$(whiptail --clear --title "Update Options" --menu "" 13 55 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) @@ -315,4 +318,7 @@ case $CHOICE in SPECTER) /home/admin/config.scripts/bonus.cryptoadvance-specter.sh update ;; + RTL) + /home/admin/config.scripts/bonus.rtl.sh update + ;; esac diff --git a/home.admin/config.scripts/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index dd328f3d2..675d99607 100755 --- a/home.admin/config.scripts/bonus.rtl.sh +++ b/home.admin/config.scripts/bonus.rtl.sh @@ -89,7 +89,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then 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 v0.9.0 + sudo -u rtl git reset --hard v0.9.1 # from https://github.com/Ride-The-Lightning/RTL/commits/master # git checkout 917feebfa4fb583360c140e817c266649307ef72 if [ -d "/home/rtl/RTL" ]; then @@ -246,6 +246,39 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then exit 0 fi +# update +if [ "$1" = "update" ]; then + echo "# UPDATING RTL" + cd /home/rtl/RTL + # from https://github.com/apotdevin/thunderhub/blob/master/scripts/updateToLatest.sh + # fetch latest master + sudo -u rtl git fetch + # unset $1 + set -- + 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 rtl git pull -p + echo "# Reset to the latest release tag" + TAG=$(git tag | sort -V | tail -1) + sudo -u rtl git reset --hard $TAG + # https://github.com/Ride-The-Lightning/RTL#or-update-existing-dependencies + sudo -u rtl npm install --only=prod + echo "# Updated to version" $TAG + fi + + echo "# Updated to the latest in https://github.com/Ride-The-Lightning/RTL/releases" + echo "" + echo "# Starting the RTL service ... " + sudo systemctl start RTL + exit 0 +fi + echo "FAIL - Unknown Parameter $1" echo "may need reboot to run normal again" exit 1 diff --git a/home.admin/config.scripts/bonus.thunderhub.sh b/home.admin/config.scripts/bonus.thunderhub.sh index bf89dffaf..9309751bb 100755 --- a/home.admin/config.scripts/bonus.thunderhub.sh +++ b/home.admin/config.scripts/bonus.thunderhub.sh @@ -279,41 +279,45 @@ fi # update if [ "$1" = "update" ]; then - echo "*** UPDATING THUNDERHUB ***" + echo "# UPDATING THUNDERHUB" cd /home/thunderhub/thunderhub # from https://github.com/apotdevin/thunderhub/blob/master/scripts/updateToLatest.sh # fetch latest master sudo -u thunderhub git fetch + # unset $1 + set -- 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 + echo "# Up-to-date on version" $TAG else - echo "Pulling latest changes..." + echo "# Pulling latest changes..." sudo -u thunderhub git pull -p + echo "# Reset to the latest release tag" + TAG=$(git tag | sort -V | tail -1) + sudo -u thunderhub git reset --hard $TAG # install deps - echo "Installing dependencies..." + echo "# Installing dependencies..." sudo -u thunderhub npm install --quiet if ! [ $? -eq 0 ]; then - echo "FAIL - npm install did not run correctly, aborting" + echo "# FAIL - npm install did not run correctly, aborting" exit 1 fi # build nextjs - echo "Building application..." + echo "# Building application..." sudo -u thunderhub npm run build - TAG=$(git tag | sort -V | tail -1) - echo "Updated to version" $TAG + echo "# Updated to version" $TAG fi - echo "*** Updated to the latest in https://github.com/apotdevin/thunderhub ***" + echo "# Updated to the release in https://github.com/apotdevin/thunderhub" echo "" - echo "*** Starting the ThunderHub service ... *** " + echo "# Starting the ThunderHub service ... *** " sudo systemctl start thunderhub exit 0 fi