-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathuninstall-slack.sh
74 lines (59 loc) · 1.36 KB
/
uninstall-slack.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
###
#
# Name: uninstall_slack.sh
# Description: This script is designed to uninstall the Slack app and its
# related components.
# Author: Emily KW
# Created: 2021-07-25
#
###
#################
### Variables ###
#################
# Items at the system level to be removed
systemItems=(
/Applications/Slack.app
)
# Items at the user level to be removed
userItems=(
Library/Application\ Scripts/com.tinyspeck.slackmacgap
Library/Containers/com.tinyspeck.slackmacgap
Library/Containers/com.tinyspeck.slackmacgap/Data/Library/Saved\ Application\ State/com.tinyspeck.slackmacgap.savedState
)
#################
### Functions ###
#################
function deleteItems()
{
declare -a toDelete=("${!1}")
for item in "${toDelete[@]}"
do
if [[ ! -z "${2}" ]]
then
item=("${2}""${item}")
fi
echo "Looking for $item"
if [ -e "${item}" ]
then
echo "Removing $item"
rm -rf "${item}"
fi
done
}
####################
### Main Program ###
####################
# Kill the app, if running
echo "Killing Slack app process"
killall "Slack"
# Delete system level items
deleteItems systemItems[@]
# Delete user level items
for dirs in /Users/*/
do
deleteItems userItems[@] "${dirs}"
done
# Forgetting app install receipt
pkgutil --forget com.tinyspeck.slackmacgap
exit 0