forked from manuelgustavo/ubuntu-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu.sh
executable file
·233 lines (213 loc) · 8.42 KB
/
ubuntu.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/bin/bash
#set -x
set -euo pipefail
installed=""
not_installed=""
install_brave()
{
echo Installing BRAVE
sudo apt-get install -y curl
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt-get update -y -q
sudo apt-get install -y -q brave-browser
installed+="Brave\n"
}
set_dark_theme()
{
echo "Setting up theme to Yaru-dark"
declare release
release="$(lsb_release -r | awk -F '\t' '{print $2}')"
if [[ "${release}" = "20.04" ]]
then
gsettings set org.gnome.desktop.interface gtk-theme 'Yaru-dark'
elif [[ "${release}" = "22.04" ]]
then
gsettings set org.gnome.desktop.interface gtk-theme Yaru-dark # Legacy apps, can specify an accent such as Yaru-olive-dark
gsettings set org.gnome.desktop.interface color-scheme prefer-dark # new apps
installed+="Dark Theme\n"
else
echo "Cannot setup theme for Ubuntu ${release}!"
not_installed+="Dark Theme\n"
fi
}
install_oh_my_zsh()
{
if [[ ! -d "$HOME/.oh-my-zsh" ]]
then
{
echo "Installing oh-my-zsh"
wget --no-cache -O "$HOME/.zshrc" "https://raw.githubusercontent.com/manuelgustavo/ubuntu-setup/main/.zshrc"
sudo apt-get install -y -q zsh fonts-powerline
# chsh -s "$(which zsh)"
#sudo apt-get install -y -q zsh-autosuggestions zsh-syntax-highlighting
# install oh-my-zsh
rm -fr "$HOME/.oh-my-zsh"
sh -c "$(wget --no-cache -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended --skip-chsh --keep-zshrc"
git clone --quiet --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --quiet --depth 1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone --quiet --depth 1 https://github.com/paulirish/git-open.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-open
# Change the default shell
sudo sed -i -E "s/($USER.*)(bash)/\1zsh/" /etc/passwd
sudo update-passwd
installed+="oh-my-zsh\n"
}
else
{
echo "If you want to install oh-my-zsh, delete the ~/.oh-my-zsh directory"
not_installed+="oh-my-zsh\n"
}
fi
# wget --no-cache https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
# sed -i.tmp 's:env zsh::g' install.sh
# sed -i.tmp 's:chsh -s .*$::g' install.sh
# sh install.sh
}
install_gnome_extensions()
{
sudo apt-get install -y -q \
gnome-tweaks \
gnome-shell-extensions \
chrome-gnome-shell \
gir1.2-gtop-2.0 \
gir1.2-nm-1.0 \
gir1.2-clutter-1.0 \
gnome-system-monitor
declare gnome_extension
gnome_extension="[email protected]"
if [[ ! -d "$HOME/.local/share/gnome-shell/extensions/${gnome_extension}" ]]
then
{
echo "Installing Gnome Extension -- Dash to Panel https://extensions.gnome.org/extension/1160/dash-to-panel/"
gdbus call --session \
--dest org.gnome.Shell.Extensions \
--object-path /org/gnome/Shell/Extensions \
--method org.gnome.Shell.Extensions.InstallRemoteExtension \
"${gnome_extension}" 2>/dev/null || true
installed+="Gnome Extension -- Dash to Panel\n"
}
else
{
echo "Skipping Dash to Panel -- already installed."
not_installed+="Gnome Extension -- Dash to Panel\n"
}
fi
# TODO: The below needs to be re-enabled when made available!
# echo "Installing Gnome Extension -- system-monitor https://extensions.gnome.org/extension/120/system-monitor/"
# gdbus call --session \
# --dest org.gnome.Shell.Extensions \
# --object-path /org/gnome/Shell/Extensions \
# --method org.gnome.Shell.Extensions.InstallRemoteExtension \
# "[email protected]" 2>/dev/null
gnome_extension="[email protected]"
if [[ ! -d "$HOME/.local/share/gnome-shell/extensions/${gnome_extension}" ]]
then
{
echo "Installing Gnome Extension -- system-monitor-next https://extensions.gnome.org/extension/3010/system-monitor-next/"
gdbus call --session \
--dest org.gnome.Shell.Extensions \
--object-path /org/gnome/Shell/Extensions \
--method org.gnome.Shell.Extensions.InstallRemoteExtension \
"${gnome_extension}" 2>/dev/null || true
installed+="Gnome Extension -- system-monitor-next\n"
}
else
{
echo "Skipping system-monitor-next -- already installed."
not_installed+="Gnome Extension -- system-monitor-next\n"
}
fi
gnome_extension="[email protected]"
if [[ ! -d "$HOME/.local/share/gnome-shell/extensions/${gnome_extension}" ]]
then
{
echo "Installing Gnome Extension -- Removable Drive Menu https://extensions.gnome.org/extension/7/removable-drive-menu/"
gdbus call --session \
--dest org.gnome.Shell.Extensions \
--object-path /org/gnome/Shell/Extensions \
--method org.gnome.Shell.Extensions.InstallRemoteExtension \
"${gnome_extension}" 2>/dev/null || true
installed+="Gnome Extension -- Removable Drive\n"
}
else
{
echo "Skipping Removable Drive Menu -- already installed."
not_installed+="Gnome Extension -- Removable Drive Menu\n"
}
fi
}
install_tilix()
{
sudo apt-get -y -q install tilix
wget --no-cache -O- "https://raw.githubusercontent.com/manuelgustavo/ubuntu-setup/main/tilix_rosipov-grey-ld.conf" | dconf load /com/gexperts/Tilix/
# dconf dump /com/gexperts/Tilix/ >[filename.conf]
# Install Powerline Droid Sans Mono Dotted.
mkdir -p "$HOME/.local/share/fonts"
wget --no-cache -O "$HOME/.local/share/fonts/Droid Sans Mono Dotted for Powerline.ttf" "https://raw.githubusercontent.com/powerline/fonts/master/DroidSansMonoDotted/Droid%20Sans%20Mono%20Dotted%20for%20Powerline.ttf"
fc-cache -f
sudo update-alternatives --set x-terminal-emulator /usr/bin/tilix.wrapper
sudo ln -s /etc/profile.d/vte-2.91.sh /etc/profile.d/vte.sh || true
{
echo
echo 'if [ $TILIX_ID ] || [ $VTE_VERSION ]; then'
echo ' source /etc/profile.d/vte.sh'
echo 'fi'
} >> "$HOME/.zshrc"
installed+="Tilix\n"
}
install_vscode()
{
echo "Installing VSCode"
declare temp="$(mktemp -d)"
cd "${temp}"
sudo apt-get install -y gpg
wget --no-cache -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
cd -
rm -fr "${temp}"
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install code
echo "Installing VSCode extensions..."
sh -c "$(wget --no-cache -O- https://raw.githubusercontent.com/manuelgustavo/vscode-extensions/main/vscode-extensions.sh)"
installed+="VScode + extensions\n"
}
main()
{
sudo apt-get update -q
sudo apt-get install -y -q git wget
# install_gnome_extensions
# install_brave
# set_dark_theme
install_oh_my_zsh
install_tilix
install_vscode
echo .
echo .
echo .
echo "SCRIPT SUCCESS!"
echo .
echo "-------------------- Summary --------------------"
if [[ -n "${installed}" ]]
then
{
echo "Installed:"
printf "${installed}"
}
fi
echo "-------------------------------------------------"
if [[ -n "${not_installed}" ]]
then
{
echo "Skipped:"
printf "${not_installed}"
}
fi
echo "-------------------------------------------------"
echo .
echo .
echo "It's recommended to log-off and log-on again!"
}
main "$@"