-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·327 lines (270 loc) · 12.8 KB
/
setup.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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#!/bin/bash
# set some colors
CNT="[\e[1;36mNOTE\e[0m]"
COK="[\e[1;32mOK\e[0m]"
CER="[\e[1;31mERROR\e[0m]"
CAT="[\e[1;37mATTENTION\e[0m]"
CWR="[\e[1;35mWARNING\e[0m]"
CAC="[\e[1;33mACTION\e[0m]"
INSTLOG="install.log"
#clear the screen
clear
# set some expectations for the user
echo -e "$CNT - You are about to execute a script that would attempt to setup Hyprland.
Please note that Hyprland is still in Beta.
Please note that VMs are not fully supported and if you try to run this on
a Virtual Machine there is a high chance this will fail.
Please note that support for Nvidia GPUs is limited and may require
more work which is beyond the scope of this script.
\n"
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to continue with the install (y,n) ' INST
if [[ $INST == "Y" || $INST == "y" ]]; then
echo -e "$COK - Starting install script.."
else
echo -e "$CNT - This script would now exit, no changes were made to your system."
exit
fi
echo -e "\n
$CNT - This script will run some commands that require sudo. You will be prompted to enter your password.
If you are worried about entering your password then you may want to review the content of the script."
#### Check for yay ####
ISYAY=/sbin/yay
if [ -f "$ISYAY" ]; then
echo -e "$COK - yay was located, moving on."
else
echo -e "$CWR - Yay was NOT located"
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to install yay (y,n) ' INSTYAY
if [[ $INSTYAY == "Y" || $INSTYAY == "y" ]]; then
git clone https://aur.archlinux.org/yay.git &>> $INSTLOG
cd yay
makepkg -si --noconfirm &>> ../$INSTLOG
cd ..
else
echo -e "$CER - Yay is required for this script, now exiting"
exit
fi
fi
### Disable wifi powersave mode ###
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to disable WiFi powersave? (y,n) ' WIFI
if [[ $WIFI == "Y" || $WIFI == "y" ]]; then
LOC="/etc/NetworkManager/conf.d/wifi-powersave.conf"
echo -e "$CNT - The following file has been created $LOC."
echo -e "[connection]\nwifi.powersave = 2" | sudo tee -a $LOC &>> $INSTLOG
echo -e "\n"
sleep 1
sudo systemctl restart NetworkManager &>> $INSTLOG
sleep 3
fi
### Restart alsa on resume to fix no sound after standby ###
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to restart alsa after suspend? (y,n) ' ALSA
if [[ $ALSA == "Y" || $ALSA == "y" ]]; then
LOC="/etc/systemd/system/[email protected]"
sudo cp ./systemd/[email protected] $LOC
echo -e "$CNT - The following file has been created $LOC."
sleep 1
sudo systemctl enable "resume@${USER}.service"
fi
### Install all of the above pacakges ####
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to install the packages? (y,n) ' INST
if [[ $INST == "Y" || $INST == "y" ]]; then
# update the DB first
echo -e "$COK - Updating yay database..."
yay -Syu --noconfirm &>> $INSTLOG
PACKAGES="ttf-dejavu ttf-jetbrains-mono-nerd noto-fonts-emoji otf-font-awesome adobe-source-han-sans-otc-fonts"
PACKAGES="$PACKAGES git tk polkit-gnome python-requests pamixer pavucontrol brightnessctl mpv xorg-xev"
PACKAGES="$PACKAGES less wl-clipboard xorg-xhost wf-recorder zenity jq xdg-utils ntfs-3g"
PACKAGES="$PACKAGES pipewire wireplumber pipewire-pulse pipewire-audio pipewire-alsa"
PACKAGES="$PACKAGES hyprland alacritty waybar swww swaylock-effects wofi wlogout swayidle"
PACKAGES="$PACKAGES swaync-git xdg-desktop-portal-hyprland swappy grim slurp thunar kdeconnect breeze-icons shotwell"
PACKAGES="$PACKAGES bluez bluez-utils blueman network-manager-applet gvfs thunar-archive-plugin tumbler acpi"
PACKAGES="$PACKAGES file-roller btop pacman-contrib lxappearance xfce4-settings sddm thunar-volman"
PACKAGES="$PACKAGES gst-libav phonon-qt5-gstreamer gst-plugins-good qt5-quickcontrols qt5-graphicaleffects qt5-multimedia nwg-look"
### These are personal applications I use, feel free to remove or change ###
APPS="google-chrome gparted slack-desktop-wayland spotify"
PACKAGES="$PACKAGES $APPS"
echo -e "\n$CNT - Installing main packages, this may take a while..."
yay -S $PACKAGES --noconfirm --needed --overwrite &>> $INSTLOG
echo -e "$CNT - Set default applications..."
xdg-mime default google-chrome.desktop x-scheme-handler/https x-scheme-handler/http
xdg-settings set default-web-browser google-chrome.desktop
# start pipewire
echo -e "$CNT - Starting the Pulseaudio Service..."
systemctl --user enable pipewire.service &>> $INSTLOG
systemctl --user enable pipewire-pulse.service &>> $INSTLOG
# Start the bluetooth service
echo -e "$CNT - Starting the Bluetooth Service..."
sudo systemctl enable bluetooth.service &>> $INSTLOG
sleep 2
# Enable the sddm login manager service
echo -e "$CNT - Enabling the SDDM Service..."
sudo systemctl enable sddm &>> $INSTLOG
sleep 2
# Clean out other portals
echo -e "$CNT - Cleaning out conflicting xdg portals..."
yay -R --noconfirm xdg-desktop-portal-gnome xdg-desktop-portal-gtk xdg-desktop-portal-dde &>> $INSTLOG
fi
### These are personal applications I use, feel free to remove or change ###
PACKAGES="docker docker-compose docker-buildx virtualbox virtualbox-host-dkms linux-headers virtualbox-guest-iso virtualbox-ext-oracle tlp"
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like install these packages? '"${PACKAGES}"' (y,n) ' INST
if [[ $INST == "Y" || $INST == "y" ]]; then
echo -e "\n$CNT - Installing additional packages, this may take a while..."
yay -Syu --noconfirm &>> $INSTLOG
yay -S $PACKAGES --noconfirm --needed --overwrite &>> $INSTLOG
echo -e "\n$CNT - Adding user to groups..."
sudo usermod -aG docker,vboxusers,storage,disk,input $USER
echo -e "\n$CNT - Enabling docker and vbox services..."
sudo systemctl enable docker.service
# sudo systemctl enable systemd-modules-load.service
# enable tlp
echo -e "\n$CNT - Configuring tlp service..."
sudo systemctl enable tlp.service
sudo systemctl mask systemd-rfkill.service
sudo systemctl mask systemd-rfkill.socket
echo -e "TLP_DEFAULT_MODE=BAT" | sudo tee -a /etc/tlp.conf
echo -e "STOP_CHARGE_THRESH_BAT0=80" | sudo tee -a /etc/tlp.conf
echo -e "RESTORE_THRESHOLDS_ON_BAT=1" | sudo tee -a /etc/tlp.conf
fi
### Copy Config Files ###
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to copy config files? (y,n) ' CFG
if [[ $CFG == "Y" || $CFG == "y" ]]; then
echo -e "$CNT - Copying config files..."
for DIR in alacritty hypr swappy swaylock waybar wlogout wofi swaync gtk-3.0 Kvantum qt5ct
do
DIRPATH=~/.config/$DIR
if [ -d "$DIRPATH" ]; then
echo -e "$CAT - Config for $DIR located, backing up."
mv $DIRPATH $DIRPATH-back-$(date +"%Y%m%d%H%M%S") &>> $INSTLOG
echo -e "$COK - Backed up $DIR to $DIRPATH-back."
fi
echo -e "$CNT - Copying $DIR config to $DIRPATH."
cp -R $DIR ~/.config/ &>> $INSTLOG
done
# Set some files as exacutable
echo -e "$CNT - Setting some file as executable."
chmod +x ~/.config/hypr/scripts/*
# Copy the SDDM theme
echo -e "$CNT - Setting up the login screen."
sudo cp -R ./sddm/aerial-sddm-theme /usr/share/sddm/themes
sudo chown -R $USER:$USER /usr/share/sddm/themes/aerial-sddm-theme
sudo mkdir -p /etc/sddm.conf.d
echo -e "[Theme]\nCurrent=aerial-sddm-theme" | sudo tee /etc/sddm.conf.d/10-theme.conf &>> $INSTLOG
WLDIR=/usr/share/wayland-sessions
if [ -d "$WLDIR" ]; then
echo -e "$COK - $WLDIR found"
else
echo -e "$CWR - $WLDIR NOT found, creating..."
sudo mkdir -p $WLDIR
fi
sudo cp extras/hyprland.desktop /usr/share/wayland-sessions/
sudo sudo sed -i 's/Exec=Hyprland/Exec=\/home\/'$USER'\/start-hypr/' /usr/share/wayland-sessions/hyprland.desktop
cp extras/start-hypr ~/
#setup the first look and feel as dark
xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita-dark"
xfconf-query -c xsettings -p /Net/IconThemeName -s "Adwaita-dark"
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
gsettings set org.gnome.desktop.interface icon-theme "Adwaita-dark"
# Set deskstop wallpaper
# Cycle wallpapers in ~/.config/hypr/wallpapers every 5 mins
echo -e "$CNT - Configuring desktop wallpapers..."
mkdir -p ~/.config/systemd/user
cp -r systemd/user/. ~/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable bgaction.timer
systemctl --user start bgaction.timer
systemctl --user status bgaction.timer
# Copy electron configs
cp ./extras/electron* ~/.config
fi
### Enable hiDPI for hi-res screens ###
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to enable hiDPI? (y,n) ' HIDPI
if [[ $HIDPI == "Y" || $HIDPI == "y" ]]; then
sudo cp ./sddm/sddm.conf.d/hidpi.conf /etc/sddm.conf.d/
fi
### Install software for Asus ROG laptops ###
read -n1 -rep $'[\e[1;33mACTION\e[0m] - For ASUS ROG Laptops - Would you like to install Asus ROG software support? (y,n) ' ROG
if [[ $ROG == "Y" || $ROG == "y" ]]; then
echo -e "$CNT - Adding Keys..."
sudo pacman-key --recv-keys 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
sudo pacman-key --finger 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
sudo pacman-key --lsign-key 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
sudo pacman-key --finger 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
LOC="/etc/pacman.conf"
echo -e "$CNT - Updating $LOC with g14 repo."
echo -e "\n[g14]\nServer = https://arch.asus-linux.org" | sudo tee -a $LOC &>> $INSTLOG
echo -e "\n"
echo -e "$CNT - Update the system..."
sudo pacman -Suy --noconfirm &>> $INSTLOG
echo -e "$CNT - Installing ROG pacakges..."
sudo pacman -S --noconfirm asusctl supergfxctl rog-control-center &>> $INSTLOG
echo -e "$CNT - Activating ROG services..."
sudo systemctl enable --now power-profiles-daemon.service &>> $INSTLOG
sleep 2
sudo systemctl enable --now supergfxd &>> $INSTLOG
sleep 2
#add the keybinding file to the config
echo -e "\nsource = ~/.config/hypr/rog-g15-strix-2021-binds.conf" >> ~/.config/hypr/hyprland.conf
fi
### Install grub theme ###
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would like to install grub theme? (y,n) ' GRUB
if [[ $GRUB == "Y" || $GRUB == "y" ]]; then
workdir=$(pwd)
extract_dir="/tmp/grub2-cybre"
rm -rf $extract_dir
mkdir -p $extract_dir
echo -e "$CNT - Installing grub theme..."
tar xvf ./extras/Grub2-theme_CyberRe-1.0.0.tar.gz --directory "${extract_dir}" &>> $INSTLOG && \
cd "${extract_dir}/CyberRe 1.0.0" && ./install.sh && \
echo -e "GRUB_GFXMODE=1920x1080x32" | sudo tee -a /etc/default/grub &>> $INSTLOG && \
sudo grub-mkconfig -o /boot/grub/grub.cfg &>> $INSTLOG
cd $workdir
fi
### Install zsh shell
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to install ZSH shell? (y,n) ' ZSH
if [[ $ZSH == "Y" || $ZSH == "y" ]]; then
echo -e "$CNT - Installing zsh..."
yay -S curl bash curl git zsh zsh-completions --noconfirm --needed --overwrite &>> $INSTLOG
echo -e "$CNT - Installing Oh My ZSH..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --keep-zshrc --unattended
AUTOSUGST_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
SNTXH_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
if [ -f ~/.zshrc ];then
echo -e "$CNT - Creating back up of ~/.zshrc ..."
cp ~/.zshrc ~/.zshrc-backup-$(date +"%Y%m%d%H%M%S")
fi
if [ ! -d $AUTOSUGST_DIR ];then
echo -e "$CNT - Installing zsh-autosuggestions..."
git clone https://github.com/zsh-users/zsh-autosuggestions $AUTOSUGST_DIR &
fi
if [ ! -d $SNTXH_DIR ];then
echo -e "$CNT - Installing zsh-syntax-highlighting..."
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $SNTXH_DIR &
fi
wait
cp zsh/.zshrc ~/.zshrc
cp zsh/starship.toml ~/.config/
fi
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to install tmux? (y,n) ' TMUX
if [[ $TMUX == "Y" || $TMUX == "y" ]]; then
workdir=$(pwd)
cd tmux
echo -e "$CNT - Installing tmux..."
yay -S make cmake tmux --noconfirm --needed --overwrite &>> $INSTLOG
rm -rf ~/.config/tmux
mkdir -p ~/.config/tmux
cp -r ./* ~/.config/tmux
mkdir -p ~/.tmux ~/.config/tmux/plugins
ln -sf ~/.config/tmux/tmux.conf ~/.tmux.conf
ln -sf ~/.config/tmux/plugins ~/.tmux/plugins
if [ ! -d ~/.tmux/plugins/tpm ];then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
cd $workdir
fi
### Script is done ###
echo -e "$CNT - Script had completed!"
read -n1 -rep $'[\e[1;33mACTION\e[0m] - Would you like to reboot now? (y,n) ' HYP
if [[ $HYP == "Y" || $HYP == "y" ]]; then
sudo reboot
else
exit
fi