-
Notifications
You must be signed in to change notification settings - Fork 24
/
remove
executable file
·86 lines (63 loc) · 2.41 KB
/
remove
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
#!/bin/bash
# Copyright (C) 2015-2018, 2024 Rafael Senties Martinelli.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License 3 as published by
# the Free Software Foundation.
#
# 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
if [ "$EUID" -ne 0 ]
then echo "The script must be run as root."
exit
fi
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd "$DIR"
if [ -f /bin/systemctl ]; then
echo -e "\n\033[0;32m Disabling the systemd daemon...\033[0m"
systemctl stop akbl
systemctl disable akbl
echo ""
fi
echo -e "\033[0;32m Removing the python links..\033[0m"
AKBL_PYTHON_VERSIONS=($(ls /usr/lib/ | grep python3))
for python_version in "${AKBL_PYTHON_VERSIONS[@]}"; do
if [[ "$python_version" != "python3" ]]; then
if [[ -L "/usr/lib/$python_version/AKBL" ]]; then
rm -f "/usr/lib/$python_version/AKBL" && echo -e "/usr/lib/$python_version/AKBL link removed"
fi
if [ -f "/usr/lib/$python_version/AKBL" ] || [ -f "/usr/lib/$python_version/AKBL.py" ]; then
rm -f "/usr/lib/$python_version/AKBL" && echo -e "/usr/lib/$python_version/AKBL file removed"
fi
if [ -d "/usr/lib/$python_version/AKBL" ] || [ -d "/usr/lib/$python_version/AKBL.py" ]; then
rm -rf "/usr/lib/$python_version/AKBL.py" && echo -e "/usr/lib/$python_version/AKBL directory removed"
fi
fi
done
echo ""
echo -e "\033[0;32m Removing the software files and directories..\033[0m"
function remove_file(){
if [ -f "$1" ]; then
rm -f "$1"
echo "removed.f: $1"
fi
}
function remove_dir(){
if [ -d "$1" ]; then
rm -rf "$1"
echo "removed.d: $1"
fi
}
remove_file "/usr/share/applications/AKBL.desktop"
remove_file "/usr/share/applications/com.senties-martinelli.AKBL.desktop"
remove_file "/usr/bin/akbl"
remove_file "/usr/lib/systemd/system/AKBL.service"
remove_dir "/usr/share/AKBL"
remove_dir "/usr/share/doc/AKBL"
remove_dir "/usr/lib/python3/AKBL"