-
Notifications
You must be signed in to change notification settings - Fork 6
/
uninstall.sh
116 lines (75 loc) · 2.41 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "run script with superuser priveledge"
exit
fi
#check for error function
check(){
if [[ $? -eq 0 ]]; then
continue &> /dev/null
else
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mSCript has failed due to some unknown error\e[0m"
exit
fi
}
#uninstall function
uninstall(){
check
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mStopping waydroid session\e[0m"
waydroid session stop
check
sudo waydroid container stop
check
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mDetecting your distro\e[0m"
#check if distro is fedora
fedora=$(source /etc/os-release && echo $ID)
version=$(source /etc/os-release && echo $VERSION_ID)
#check if distro is arch based
arch=$(source /etc/os-release && echo $ID)
kernel=$(uname -r | cut -c -6)
if [[ "$fedora" == "fedora" ]]; then
#remove waydroid if distro is fedora based
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mYour distro is fedora\e[0m"
sleep 0.5
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mUninstalling waydroid\e[0m"
sudo dnf remove waydroid
check
elif [[ "$arch" == "arch" ]]; then
#remove waydroid if it pacman
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mYour distro is arch\e[0m"
sleep 0.5
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mUninstalling waydroid\e[0m"
pacman -R waydroid
check
pacman -R $(pacman -Qdtq)
check
else
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mYou're running a debian distro\e[0m"
apt remove waydroid
check
fi
#remove additional files
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mRemoving additional waydroid files\e[0m"
rm -rf /var/lib/waydroid /home/.waydroid ~/waydroid ~/.share/waydroid ~/.local/share/applications/*aydroid* ~/.local/share/waydroid
check
sleep 1
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mUninstall successfully\e[0m"
}
#confirm if user wants to uninstall
read -p $'\e[32m[\e[35m*\e[32m] \e[1;32mDo you want uninstall waydroid(y/n[yes/no] - default:- n): \e[0m' del
if [[ $del == "n" || $del == "N" ]]; then
echo " "
echo "Exiting uninstaller"
sleep 1
exit
elif [[ $del == "y" || $del == "Y" ]]; then
echo " "
uninstall
elif [[ $del == "" ]]; then
echo " "
echo "Exiting uninstaller"
sleep 1
exit
else
bash uninstall.sh
fi