-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall
executable file
·56 lines (47 loc) · 1.49 KB
/
uninstall
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
#!/usr/bin/env sh
INSTALL_DIR="$HOME"
echo "We'll be uninstalling hoard ($INSTALL_DIR/bin/hoard) and all related files. User data won't be deleted. [ctrl-c to cancel]"
sleep 2
#Remove installed script
(rm $INSTALL_DIR/bin/hoard >> /dev/null 2>&1 && echo "Uninstalled 'hoard' previously located at $INSTALL_DIR/bin/hoard")
#Clear deprecated installation directory
if [ "`uname`" == "Darwin" ]; then
if [ -f "/usr/local/bin/hoard" ]; then
rm "/usr/local/bin/hoard"
fi
fi
#Retrieve user shell profile
shell="`basename $SHELL`"
file=
case "$shell" in
"bash")
if [ -f "$HOME/.bashrc" ]; then
file="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
file="$HOME/.bash_profile"
elif [ -f "$HOME/.profile" ]; then
file="$HOME/.profile"
fi
;;
"zsh")
file="$HOME/.zshrc"
;;
"ksh")
file="$HOME/.kshrc"
;;
esac
#Remove config from shell profile
if [ -z "$file" ]; then
echo "We've removed everything related to 'hoard'."
echo "However, please remove 'source hoard' from your startup script if you ever added that manually."
else
if [ "`uname`" == "Darwin" ]; then
sed -i '' "/\. .*hoard$/g" "$file"
sed -i '' "/^source .*hoard$/g" "$file"
else
sed -i "/\. .*hoard$/g" "$file"
sed -i "/^source .*hoard$/g" "$file"
fi
echo "We've removed everything related to 'hoard' installed for $shell"
fi
echo "Please restart all existing terminal windows to completely remove the ability to run 'hoard'."