mirror of
https://github.com/MLBZ521/MacAdmin.git
synced 2026-02-03 14:03:26 +00:00
v1.4.0 = Adjusted logic to support more versions
+ Instead of checking for versions, checking if uninstall scripts exist any using them if so + Fixed a logic issue or two
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
###################################################################################################
|
||||
# Script Name: uninstall_Avast.sh
|
||||
# By: Zack Thompson / Created: 8/16/2019
|
||||
# Version: 1.3.0 / Updated: 1/24/2020 / By: ZT
|
||||
# Version: 1.4.0 / Updated: 5/12/2022 / By: ZT
|
||||
#
|
||||
# Description: Uninstalls Avast using the built in uninstall script.
|
||||
#
|
||||
@@ -23,7 +23,7 @@ echo "Searching for existing Avast instances..."
|
||||
|
||||
appPaths=$( /usr/bin/find -E /Applications "/Users/${currentUser}" -iregex ".*[/]Avast[.]app" -type d -prune 2>&1 | /usr/bin/grep -v "Operation not permitted" )
|
||||
|
||||
while IFS="\n" read -r appPath; do
|
||||
while IFS=$'\n' read -r appPath; do
|
||||
echo "Checking path: ${appPath}"
|
||||
|
||||
# Verify Avast exists in the expected location
|
||||
@@ -38,20 +38,28 @@ while IFS="\n" read -r appPath; do
|
||||
"11" | "12" )
|
||||
"/Library/Application Support/Avast/components/uninstall/com.avast.uninstall.app/Contents/Resources/uninstall.sh"
|
||||
;;
|
||||
"13" | "14" )
|
||||
# "13" | "14" )
|
||||
# if [[ -e "${appPath}/Contents/Backend/utils/com.avast.uninstall.app/Contents/Resources/uninstall.sh" ]]; then
|
||||
# "${appPath}/Contents/Backend/utils/com.avast.uninstall.app/Contents/Resources/uninstall.sh"
|
||||
# elif [[ -e "${appPath}/Contents/Backend/hub/uninstall.sh" ]]; then
|
||||
# "${appPath}/Contents/Backend/hub/uninstall.sh"
|
||||
# fi
|
||||
# ;;
|
||||
* )
|
||||
if [[ -e "${appPath}/Contents/Backend/utils/com.avast.uninstall.app/Contents/Resources/uninstall.sh" ]]; then
|
||||
"${appPath}/Contents/Backend/utils/com.avast.uninstall.app/Contents/Resources/uninstall.sh"
|
||||
elif [[ -e "${appPath}/Contents/Backend/hub/uninstall.sh" ]]; then
|
||||
"${appPath}/Contents/Backend/hub/uninstall.sh"
|
||||
else
|
||||
echo "ERROR: Unable to uninstall this version!"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
echo "ERROR: Unable to uninstall this version!"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $? = 0 ]]; then
|
||||
exit_code=$?
|
||||
|
||||
if [[ $exit_code == "0" ]]; then
|
||||
echo " -> Success"
|
||||
successfulExit="0"
|
||||
else
|
||||
@@ -66,7 +74,7 @@ while IFS="\n" read -r appPath; do
|
||||
|
||||
done < <(echo "${appPaths}")
|
||||
|
||||
if [[ "${successfulExit}" != "" ]]; then
|
||||
if [[ "${successfulExit}" == "0" ]]; then
|
||||
echo "***** Uninstall Avast process: COMPLETE *****"
|
||||
# If Avast was uninstalled successfully, then run a recon
|
||||
"${jamfBin}" recon
|
||||
Reference in New Issue
Block a user