-
Notifications
You must be signed in to change notification settings - Fork 0
/
QualysCloudAgent_Uninstaller-3.7.0-54.sh
47 lines (39 loc) · 1.32 KB
/
QualysCloudAgent_Uninstaller-3.7.0-54.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
BASE_DIRe=/Applications/QualysCloudAgent.app
if [ -d "$BASE_DIRe" ];then
echo "QualysCloudAgent found"
## This script may also be invoked from cloud-agent daemon
#remove the plist file
set -e
echo "Uninstalling cloud agent"
cd /
pkgutil --forget com.qualys.cloud-agent
# give command to stop the agent and then only delete the files
# launchctl remove com.qualys.cloud.agent-restart
launchctl remove com.qualys.cloud-agent
sleep 3
rm /Library/LaunchDaemons/com.qualys.cloud-agent.plist
BASE_DIR=/Applications/QualysCloudAgent.app/Contents/
APP_SUPPORT_DIR="/Library/Application Support/QualysCloudAgent/"
LOG_DIR=/var/log/qualys
# remove all App data under APP_SUPPORT_DIR.
if [ -d "$APP_SUPPORT_DIR" ];then
rm -rf "$APP_SUPPORT_DIR"
fi
#remove all files except hostid
find /Applications/QualysCloudAgent.app/ ! -name 'hostid' -type f -exec rm -f {} +
rm -rf /etc/qualys/.stage/
#remove all links
find /Applications/QualysCloudAgent.app/ -type l -exec rm -f {} +
#find empty directories under install folders and delete them
find /Applications/QualysCloudAgent.app -empty -type d -delete || true
if [ ! -d "$BASE_DIR" ];then
rm -rf /Applications/QualysCloudAgent.app
fi
if [ -d "$LOG_DIR" ]; then
rm -rf $LOG_DIR
fi
else
echo "QualysCloudAgent Not found"
fi
exit