#!/bin/bash

# Stop the Webroot SecureAnywhere service
echo "Webroot uninstall started" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
date >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1

echo "Stopping Webroot daemon" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
launchctl unload /Library/LaunchDaemons/com.webroot.security.mac.plist >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sleep 2

echo "Terminating Webroot process" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
pkill "Webroot SecureAnywhere" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sleep 2

echo "Removing the folder /Library/LaunchDaemons/com.webroot.*" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
rm -rf /Library/LaunchDaemons/com.webroot.* >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sleep 2

echo "Removing the application /Applications/Webroot\ SecureAnywhere.app" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sudo rm -rf /Applications/Webroot\ SecureAnywhere.app >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sleep 2

echo "Removing the file /Library/Extensions/ws_kernel.kext" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
rm -rf /Library/Extensions/ws_kernel.kext >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sleep 2

echo "Removing the file /Library/Extensions/SecureAnywhere.kext" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
rm -rf /Library/Extensions/SecureAnywhere.kext >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sleep 2

echo "Removing the folder /Library/LaunchAgents/com.webroot.*" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
rm -rf /Library/LaunchAgents/com.webroot.* >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1
sleep 2

echo "Webroot uninstall completed" >> /opt/ITSPlatform/log/webrootuninstall.log 2>&1