forked from polkaulfield/ubuntu-debullshit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu-debullshit.sh
217 lines (193 loc) · 5.91 KB
/
ubuntu-debullshit.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/usr/bin/env bash
disable_ubuntu_report() {
ubuntu-report send no
apt remove ubuntu-report -y
}
remove_appcrash_popup() {
apt remove apport apport-gtk -y
}
remove_snaps() {
while [ "$(snap list | wc -l)" -gt 0 ]; do
for snap in $(snap list | tail -n +2 | cut -d ' ' -f 1); do
snap remove --purge "$snap"
done
done
systemctl stop snapd
systemctl disable snapd
systemctl mask snapd
apt purge snapd -y
rm -rf /snap /var/lib/snapd
for userpath in /home/*; do
rm -rf $userpath/snap
done
cat <<-EOF | tee /etc/apt/preferences.d/nosnap.pref
Package: snapd
Pin: release a=*
Pin-Priority: -10
EOF
}
update_system() {
apt update && apt upgrade -y
}
cleanup() {
apt autoremove -y
}
setup_flathub() {
apt install flatpak -y
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
apt install --install-suggests gnome-software -y
}
setup_vanilla_gnome() {
apt install gnome-session fonts-cantarell adwaita-icon-theme-full gnome-backgrounds gnome-tweaks qgnomeplatform-qt5 -y
update-alternatives --set gdm-theme.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource
apt remove ubuntu-session -y
}
install_adwgtk3() {
logged_user=$(logname)
sudo apt install dbus-x11
wget https://github.com/lassekongo83/adw-gtk3/releases/download/v4.6/adw-gtk3v4-6.tar.xz -O /tmp/adw-gtk3.tar.xz
tar -xvf /tmp/adw-gtk3.tar.xz -C /usr/share/themes
flatpak install -y runtime/org.gtk.Gtk3theme.adw-gtk3-dark/x86_64/3.22
flatpak install -y runtime/org.gtk.Gtk3theme.adw-gtk3/x86_64/3.22
if [ "$(sudo -Hu $logged_user dbus-launch gsettings get org.gnome.desktop.interface color-scheme)" == ''\''prefer-dark'\''' ]; then
sudo -Hu $logged_user dbus-launch gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3-dark'
sudo -Hu $logged_user dbus-launch gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
else
sudo -Hu $logged_user dbus-launch gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'
fi
}
install_icons() {
wget https://deb.debian.org/debian/pool/main/a/adwaita-icon-theme/adwaita-icon-theme_43-1_all.deb -O /tmp/adwaita-icon-theme.deb
apt install /tmp/adwaita-icon-theme.deb -y
}
restore_firefox() {
flatpak install -y app/org.mozilla.firefox/x86_64/stable
}
ask_reboot() {
echo 'Reboot now? (y/n)'
while true; do
read choice
if [[ "$choice" == 'y' || "$choice" == 'Y' ]]; then
reboot
exit 0
fi
if [[ "$choice" == 'n' || "$choice" == 'N' ]]; then
break
fi
done
}
msg() {
tput setaf 2
echo "[*] $1"
tput sgr0
}
check_root_user() {
if [ "$(id -u)" != 0 ]; then
echo 'Please run the script as root!'
echo 'We need to do administrative tasks'
exit
fi
}
print_banner() {
echo '
▐ ▗ ▐ ▐ ▝▜ ▝▜ ▐ ▝ ▗ ▗
▗ ▗ ▐▄▖ ▗ ▗ ▗▗▖ ▗▟▄ ▗ ▗ ▄▟ ▄▖ ▐▄▖ ▗ ▗ ▐ ▐ ▄▖ ▐▗▖ ▗▄ ▗▟▄ ▐
▐ ▐ ▐▘▜ ▐ ▐ ▐▘▐ ▐ ▐ ▐ ▐▘▜ ▐▘▐ ▐▘▜ ▐ ▐ ▐ ▐ ▐ ▝ ▐▘▐ ▐ ▐ ▐
▐ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▀▘ ▐ ▐ ▐▀▀ ▐ ▐ ▐ ▐ ▐ ▐ ▀▚ ▐ ▐ ▐ ▐ ▝
▝▄▜ ▐▙▛ ▝▄▜ ▐ ▐ ▝▄ ▝▄▜ ▝▙█ ▝▙▞ ▐▙▛ ▝▄▜ ▝▄ ▝▄ ▝▄▞ ▐ ▐ ▗▟▄ ▝▄ ▐
By @polkaulfield
'
}
show_menu() {
echo 'Choose what to do: '
echo '1 - Apply everything (RECOMMENDED)'
echo '2 - Disable Ubuntu report'
echo '3 - Remove app crash popup'
echo '4 - Remove snaps and snapd'
echo '5 - Install flathub and gnome-software'
echo '6 - Install firefox flatpak'
echo '7 - Install vanilla GNOME session'
echo '8 - Install adw-gtk3 and latest adwaita icons'
echo 'q - Exit'
}
main() {
check_root_user
while true; do
print_banner
show_menu
read -p 'Enter your choice: ' choice
case $choice in
1)
auto
msg 'Done!'
ask_reboot
;;
2)
disable_ubuntu_report
msg 'Done!'
;;
3)
remove_appcrash_popup
msg 'Done!'
;;
4)
remove_snaps
msg 'Done!'
ask_reboot
;;
5)
update_system
setup_flathub
msg 'Done!'
ask_reboot
;;
6)
restore_firefox
msg 'Done!'
;;
7)
update_system
setup_vanilla_gnome
msg 'Done!'
ask_reboot
;;
8)
update_system
install_adwgtk3
install_icons
msg 'Done!'
ask_reboot
;;
\
q)
exit 0
;;
*)
echo 'Wrong input'
;;
esac
done
}
auto() {
msg 'Updating system'
update_system
msg 'Disabling ubuntu report'
disable_ubuntu_report
msg 'Removing annoying appcrash popup'
remove_appcrash_popup
msg 'Deleting everything snap related'
remove_snaps
msg 'Setting up flathub'
setup_flathub
msg 'Restoring Firefox as a flatpak'
restore_firefox
msg 'Installing vanilla Gnome session'
setup_vanilla_gnome
msg 'Install adw-gtk3 and set dark theme'
install_adwgtk3
msg 'Installing GNOME 43 icons'
install_icons
msg 'Cleaning up'
cleanup
}
main