-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·71 lines (67 loc) · 2.06 KB
/
install.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
if ! command -v ufw &> /dev/null; then
printf "Please make sure that ufw is properly installed\n"
exit
fi
printf "Please select\n";
if command -v smother &> /dev/null; then
printf "1: Update Smother\n"
else
printf "1: Install Smother\n"
fi
printf "2: Uninstall Smother\n";
printf "> ";
# repeat only if the user hasn't entered an integer 1-2
while ! [[ $selection =~ ^[1-2]+$ ]];
do
read selection;
# if the entered value was not one of the desired values, show this
if ! [[ $selection =~ ^[1-2]+$ ]]; then
sleep 1;
printf "$(tput setaf 9)Please try again$(tput sgr0)\n";
if command -v smother &> /dev/null; then
printf "1: Update Smother\n"
else
printf "1: Install Smother\n"
fi
printf "2: Uninstall Smother\n";
printf "> ";
fi
done
case $selection in
1)
# install
sudo systemctl enable ufw &> /dev/null
sudo ufw enable &> /dev/null
rm ~/.local/bin/smother &> /dev/null
rm ~/.local/share/applications/Smother.desktop &> /dev/null
rm ~/.icons/smother.svg &> /dev/null
cp smother.py ~/.local/bin/smother &> /dev/null
cp smother.desktop ~/.local/share/applications/smother.desktop &> /dev/null
cp smother.svg ~/.icons/smother.svg &> /dev/null
if command -v smother &> /dev/null; then
printf "Successfully installed Smother\n"
elif test -f ~/.local/bin/smother; then
printf "Successfully installed Smother\nPlease make sure that ~/.local/bin is in your PATH\n"
else
printf "Smother was not installed\n"
fi
;;
2)
# uninstall
sudo /usr/bin/ufw --force reset &> /dev/null
sudo /usr/bin/ufw enable &> /dev/null
sudo /usr/bin/rm /etc/ufw/*.rules.* &> /dev/null
sudo /usr/bin/ufw default deny incoming &> /dev/null
sudo /usr/bin/ufw default allow outgoing &> /dev/null
rm ~/.local/bin/smother &> /dev/null
rm ~/.local/share/applications/smother.desktop &> /dev/null
rm ~/.icons/smother.svg &> /dev/null
if ! test -f ~/.local/bin/smother; then
printf "Successfully uninstalled Smother\n"
else
printf "Smother was not uninstalled\n"
fi
;;
*)
;;
esac