forked from bimac/dimPi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
executable file
·53 lines (46 loc) · 1.29 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
#!/bin/bash
# Copyright (C) 2019 Florian Rau
#
# This file is part of dimPi.
#
# dimPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# dimPi 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dimPi. If not, see <https://www.gnu.org/licenses/>.
# Check for root
if [[ "$EUID" -ne 0 ]]; then
echo "Please run as root."
exit 1
fi
# Stop and disable systemd service
if `systemctl list-units --full -all | grep -Fq "dimPi.service"`; then
systemctl stop dimPi.service
systemctl disable dimPi.service
fi
# Remove systemd service
TMP="/etc/systemd/system/dimPi.service"
if test -f "$TMP"; then
rm "$TMP"
echo "Removed $TMP."
fi
# Remove dimPi directory
TMP="/opt/dimPi"
if test -d "$TMP"; then
rm -R "$TMP"
echo "Removed $TMP/."
fi
# Remove symlink to dimPi
TMP="/usr/local/bin/dimPi"
if test -h "$TMP"; then
unlink "$TMP"
echo "Removed $TMP."
fi
echo "Done."