re-run update.sh when old version detected

This commit is contained in:
wh1te909 2021-03-23 07:39:06 +00:00
parent 8d4ecc0898
commit a297dc8b3b
1 changed files with 3 additions and 4 deletions

View File

@ -1,12 +1,13 @@
#!/bin/bash #!/bin/bash
SCRIPT_VERSION="114" SCRIPT_VERSION="115"
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/update.sh' 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' LATEST_SETTINGS_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
GREEN='\033[0;32m' GREEN='\033[0;32m'
RED='\033[0;31m' RED='\033[0;31m'
NC='\033[0m' NC='\033[0m'
THIS_SCRIPT=$(readlink -f "$0")
TMP_FILE=$(mktemp -p "" "rmmupdate_XXXXXXXXXX") TMP_FILE=$(mktemp -p "" "rmmupdate_XXXXXXXXXX")
curl -s -L "${SCRIPT_URL}" > ${TMP_FILE} 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 if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then
printf >&2 "${YELLOW}Old update script detected, downloading and replacing with the latest version...${NC}\n" printf >&2 "${YELLOW}Old update script detected, downloading and replacing with the latest version...${NC}\n"
wget -q "${SCRIPT_URL}" -O update.sh wget -q "${SCRIPT_URL}" -O update.sh
printf >&2 "${YELLOW}Script updated! Please re-run ./update.sh${NC}\n" exec ${THIS_SCRIPT}
rm -f $TMP_FILE
exit 1
fi fi
rm -f $TMP_FILE rm -f $TMP_FILE