-
Notifications
You must be signed in to change notification settings - Fork 1
/
uninstall.sh
executable file
·62 lines (55 loc) · 1.54 KB
/
uninstall.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
#!/usr/bin/env bash
# Uninstall script for cmd-n-ctl part of mySatComm github project
# Intended to be run on a Raspberry Pi system
# Script Setup
# ============
set -o pipefail -o errexit
function helpmsg() {
echo "usage: uninstall.sh [--all]"
echo "Uninstalls antenna controller python libraries and scripts"
echo " --all Remove all packages, not just sainsmart-lib"
}
# Script Execution
# ================
# Notify user script is running
# -----------------------------
echo "Running cmd-n-ctl/uninstall.sh"
goflag="n"
if [ $# -gt 1 ]; then
echo "Error: too many arguments"
helpmsg
exit 1
elif [ $# -eq 1 ] && [ $1 = "-h" ]; then
helpmsg
exit 0
elif [ $# -eq 1 ] && [ $1 = '--all' ]; then
echo
echo -n "--all flag selected. This WILL uninstall ALL system dependencies,"
echo " including pip."
read -p "Continue? (y/n): " goflag
if ! [ "$goflag" = "y" ]; then
echo "Exiting"
exit 0
fi
elif [ $# -ne 0 ]; then
echo "Error: bad argument"
helpmsg
exit 1
fi
# Removing python packages
# ------------------------
source /home/$USER/.satcomm/bin/activate
echo; echo "Virtual environment activated"
pip3 uninstall "rotator" --yes
pip3 uninstall "pyserial" --yes
pip3 uninstall "click" --yes
deactivate
rm -rf /home/$USER/.satcomm
# Remove other packages as well
# -----------------------------
if [ "$goflag" = 'y' ]; then
sudo apt remove libhamlib-doc libhamlib-dev libhamlib-utils pigpio python3-pip python3-venv socat --purge
echo 'All dependencies at system-level removed'
fi
echo; echo "Removal Complete!"
exit 0