-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.sh
More file actions
46 lines (45 loc) · 1.59 KB
/
uninstall.sh
File metadata and controls
46 lines (45 loc) · 1.59 KB
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
for arg in "$@"; do
shift
case ${arg} in
"-mongo6") set -- "$@" "-m" ;;
"-mongo4") set -- "$@" "-z" ;;
"-go") set -- "$@" "-g" ;;
*) set -- "$@" "$arg"
esac
done
while getopts "mg" option; do
case ${option} in
m)
echo "Unisntalling Mongo 6.0 Repository\n"
sudo apt purge mongodb-org
read -p "Do you wish to remove the MongoDB keys and repos? (y/n): " answer
if [ "$answer" == "y" ]; then
echo "Removing List Entry\n"
sudo rm /etc/apt/sources.list.d/mongodb-org-6.0.list
echo "Removing mongodb keys\n"
sudo rm /usr/share/keyrings/server-6.0.gpg
fi
echo "MongoDB has successfully been uninstalled.\n"
;;
z)
echo "Unisntalling Mongo 4.4 Repository\n"
sudo apt purge mongodb-org
read -p "Do you wish to remove the MongoDB keys and repos? (y/n): " answer
if [ "$answer" == "y" ]; then
echo "Removing List Entry\n"
sudo rm /etc/apt/sources.list.d/mongodb-org-4.4.list
echo "Removing mongodb keys\n"
sudo rm /usr/share/keyrings/server-4.4.gpg
fi
echo "MongoDB has successfully been uninstalled.\n"
;;
g)
echo "Removing local go bin.\n"
rm -rf /usr/local/go
echo "Note this does not remove the entry to your path.\n"
;;
?)
break
;;
esac
done