diff --git a/update.sh b/update.sh index 1dc73b54..d3c43f6b 100644 --- a/update.sh +++ b/update.sh @@ -1,9 +1,10 @@ #!/bin/bash -SCRIPT_VERSION="8" +SCRIPT_VERSION="9" SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/develop/update.sh' YELLOW='\033[1;33m' GREEN='\033[0;32m' +RED='\033[0;31m' NC='\033[0m' TMP_FILE=$(mktemp -p "" "rmmupdate_XXXXXXXXXX") @@ -24,6 +25,14 @@ if [ $EUID -eq 0 ]; then exit 1 fi +strip="User=" +ORIGUSER=$(grep ${strip} /etc/systemd/system/rmm.service | sed -e "s/^${strip}//") + +if [ "$ORIGUSER" != "$USER" ]; then + printf >&2 "${RED}ERROR: You must run this update script from the same user account used during install: ${GREEN}${ORIGUSER}${NC}\n" + exit 1 +fi + # added new celery queue 9-7-2020 if [ ! -f /etc/systemd/system/celery-winupdate.service ]; then celerywinupdatesvc="$(cat << EOF