-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuninstall
executable file
·103 lines (97 loc) · 3.14 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# +----------------------------------------------------------------------------+
# | MM5D v0.6 * Growing house controlling and remote monitoring system |
# | Copyright (C) 2019-2023 Pozsár Zsolt <[email protected]> |
# | uninstall |
# | Uninstaller script |
# +----------------------------------------------------------------------------+
# This program is free software: you can redistribute it and/or modify it
# under the terms of the European Union Public License 1.1 version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.
line()
{
for ((i=0; i<${#SWCR}; i++))
do
echo -n "-"
done
echo ""
}
erase()
{
sudo rm --force $1 2> /dev/null
echo " $1"
}
erasedir()
{
sudo rmdir $1 2> /dev/null
echo " $1"
}
# constants
SWN1="MM5D"
SWN2="mm5d"
SWCR=`cat documents/copyright`
SWV=`cat documents/VERSION`
INSTDIR="local"
# uninstaller
echo -e "\n$SWN1 v$SWV uninstaller script"
echo "$SWCR"
line
sleep 1
echo "Uninstalling..."
echo "- stopping daemon:"
sudo /etc/init.d/$SWN2.sh stop
sudo /etc/init.d/matrixdisplay.sh stop
sudo systemctl disable $SWN2.service
sudo systemctl disable matrixdisplay.service
echo "- removing files:"
erase "/etc/init.d/$SWN2.sh"
erase "/etc/init.d/matrixdisplay.sh"
erase "/etc/rc0.d/K01$SWN2.sh"
erase "/etc/rc2.d/S01$SWN2.sh"
erase "/etc/rc3.d/S01$SWN2.sh"
erase "/etc/rc4.d/S01$SWN2.sh"
erase "/etc/rc5.d/S01$SWN2.sh"
erase "/etc/rc6.d/K01$SWN2.sh"
erase "/etc/rc0.d/K02matrixdisplay.sh"
erase "/etc/rc2.d/S02matrixdisplay.sh"
erase "/etc/rc3.d/S02matrixdisplay.sh"
erase "/etc/rc4.d/S02matrixdisplay.sh"
erase "/etc/rc5.d/S02matrixdisplay.sh"
erase "/etc/rc6.d/K02matrixdisplay.sh"
erase "/etc/systemd/system/$SWN2.service"
erase "/etc/systemd/system/matrixdisplay.service"
sudo systemctl daemon-reload
echo "- removing from cron:"
erase "/etc/cron.d/$SWN2"
sudo /etc/init.d/cron restart
echo "- removing files:"
erase "/usr/$INSTDIR/bin/$SWN2*"
erase "/usr/$INSTDIR/bin/matrixdisplay.py"
erase "/usr/$INSTDIR/share/doc/$SWN2/*"
erase "/usr/$INSTDIR/share/locale/*/$SWN2.msg"
erase "/usr/$INSTDIR/share/man/man1/$SWN2*"
erase "/usr/$INSTDIR/share/man/man7/getenvirconf.cgi.7.gz"
erase "/usr/$INSTDIR/share/man/man7/getdata.cgi.7.gz"
erase "/usr/$INSTDIR/share/man/man7/getpage.cgi.7.gz"
erase "/usr/$INSTDIR/share/man/man8/matrixdisplay*"
erase "/usr/$INSTDIR/share/man/man8/$SWN2*"
erase "/usr/$INSTDIR/share/$SWN2/*"
erase "/usr/lib/cgi-bin/getdata.cgi"
erase "/usr/lib/cgi-bin/getenvirconf.cgi"
erase "/usr/lib/cgi-bin/getpage.cgi"
erase "/var/$INSTDIR/lib/$SWN2/*"
erase "/var/$INSTDIR/lock/$SWN2*"
erase "/var/$INSTDIR/log/$SWN2*"
erase "/var/tmp/matrixdisplayfifo"
erase "/var/www/html/*.css"
erase "/var/www/html/*.html"
erase "/var/www/html/pics/*"
echo "- removing directories:"
erasedir "/usr/$INSTDIR/share/doc/$SWN2/"
erasedir "/usr/$INSTDIR/share/$SWN2/"
erasedir "/var/$INSTDIR/lib/$SWN2/"
sudo mv "/etc/motd.orig" "/etc/motd"
echo "Done."