forked from UniPiTechnology/evok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall-evok.sh
executable file
·74 lines (64 loc) · 1.75 KB
/
uninstall-evok.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
ask() {
# http://djm.me/ask
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
else
prompt="y/n"
default=
fi
# Ask the question
read -r -p "$1 [$prompt] " REPLY
# Default?
if [ -z "$REPLY" ]; then
REPLY=$default
fi
# Check if the reply is valid
case "$REPLY" in
Y*|y*) return 0 ;;
N*|n*) return 1 ;;
esac
done
}
uninstall_pigpio() {
rm -f /usr/local/include/pigpio.h
rm -f /usr/local/include/pigpiod_if.h
rm -f /usr/local/lib/libpigpio.a
rm -f /usr/local/lib/libpigpiod_if.a
rm -f /usr/local/bin/pig2vcd
rm -f /usr/local/bin/pigpiod
rm -f /usr/local/bin/pigs
rm -f /usr/local/man/man1/pig*.1
rm -f /usr/local/man/man3/pig*.3
}
uninstall() {
service evok stop
service pigpio stop
pip uninstall -y tornado toro jsonrpclib
apt-get remove -y python-ow python3-distutils
uninstall_pigpio
rm -rf /usr/local/lib/python2.7/dist-packages/tornadorpc_evok
rm -rf /opt/evok
rm -f /etc/evok.conf
update-rc.d -f pigpio remove
update-rc.d -f evok remove
rm -f /etc/init.d/evok
rm -f /etc/init.d/pigpiod
echo "Evok uninstalled sucessfully"
echo "Do not forget to remove its www folder /var/www/evok"
}
if [ "$EUID" -ne 0 ]
then echo "Please run this script as root"
exit
fi
echo "Warning, the following packages will be removed: evok, pigpiod, python-ow, tornado, toro, jsonrpclib, tornadorpc-evok python3-distutils"
if ask "Are you sure you want to continue?"; then
uninstall
else
echo "Evok uninstallation aborted"
fi