check user during update

This commit is contained in:
wh1te909 2020-09-20 21:29:21 +00:00
parent b9f780c596
commit 76e505c04d
1 changed files with 10 additions and 1 deletions

View File

@ -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