From a297dc8b3b4a554de42a85322edae5d5c8684c4a Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Tue, 23 Mar 2021 07:39:06 +0000 Subject: [PATCH] re-run update.sh when old version detected --- update.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/update.sh b/update.sh index 43f3a15c..f2f93aeb 100644 --- a/update.sh +++ b/update.sh @@ -1,12 +1,13 @@ #!/bin/bash -SCRIPT_VERSION="114" +SCRIPT_VERSION="115" SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/update.sh' LATEST_SETTINGS_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py' YELLOW='\033[1;33m' GREEN='\033[0;32m' RED='\033[0;31m' NC='\033[0m' +THIS_SCRIPT=$(readlink -f "$0") TMP_FILE=$(mktemp -p "" "rmmupdate_XXXXXXXXXX") curl -s -L "${SCRIPT_URL}" > ${TMP_FILE} @@ -15,9 +16,7 @@ NEW_VER=$(grep "^SCRIPT_VERSION" "$TMP_FILE" | awk -F'[="]' '{print $3}') if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then printf >&2 "${YELLOW}Old update script detected, downloading and replacing with the latest version...${NC}\n" wget -q "${SCRIPT_URL}" -O update.sh - printf >&2 "${YELLOW}Script updated! Please re-run ./update.sh${NC}\n" - rm -f $TMP_FILE - exit 1 + exec ${THIS_SCRIPT} fi rm -f $TMP_FILE