-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
370 lines (327 loc) · 10.5 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
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
#!/bin/bash
# T-Cryp Dots
# Define the software that would be inbstalled
prep_stage=(
qt5-wayland
qt5ct
qt6-wayland
qt6ct
qt5-svg
qt5-quickcontrols2
qt5-graphicaleffects
gtk3
polkit-gnome
pipewire
wireplumber
jq
wl-clipboard
cliphist
python-requests
pacman-contrib
)
#software for nvidia GPU only
nvidia_stage=(
linux-headers
nvidia-dkms
nvidia-settings
libva
libva-nvidia-driver-git
)
#the main packages
install_stage=(
kitty
mako
waybar
swww
swaylock-effects
rofi-lbonn-wayland-git
zsh-theme-powerlevel10k-git
zsh-autosuggestions
oh-my-zsh-git
zsh-syntax-highlighting
xdg-desktop-portal-hyprland
dracula-gtk-theme
dracula-icons-git
bibata-cursor-theme
swappy
eza
grim
python-pyamdgpuinfo
slurp
thunar
cava
btop
firefox
mpv
pamixer
pavucontrol
brightnessctl
bluez
bluez-utils
blueman
pywal-git
python-pywalfox
python-pywayland
network-manager-applet
visual-studio-code-bin
firefox
neofetch
gvfs
thunar-archive-plugin
file-roller
starship
papirus-icon-theme
ttf-jetbrains-mono-nerd
noto-fonts-emoji
lxappearance
xfce4-settings
nwg-look-bin
sddm
)
for str in ${myArray[@]}; do
echo $str
done
# 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"
######
# function for custom apps to install
custom_apps() {
local app_list="./custom_apps.lst"
if [[ -f "$app_list" ]]; then
echo -e "$CNT - Installing custom applications from $app_list..."
while IFS= read -r app; do
install_software "$app"
done < "$app_list"
else
echo -e "$CER - Custom applications list not found: $app_list"
fi
}
# function that would show a progress bar to the user
show_progress() {
while ps | grep $1 &> /dev/null;
do
echo -n "."
sleep 2
done
echo -en "Done!\n"
sleep 2
}
# function that will test for a package and if not found it will attempt to install it
install_software() {
# First lets see if the package is there
if yay -Q $1 &>> /dev/null ; then
echo -e "$COK - $1 is already installed."
else
# no package found so installing
echo -en "$CNT - Now installing $1 ."
yay -S --noconfirm $1 &>> $INSTLOG &
show_progress $!
# test to make sure package installed
if yay -Q $1 &>> /dev/null ; then
echo -e "\e[1A\e[K$COK - $1 was installed."
else
# if this is hit then a package is missing, exit to review log
echo -e "\e[1A\e[K$CER - $1 install had failed, please check the install.log"
exit
fi
fi
}
# 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."
sleep 1
# attempt to discover if this is a VM or not
echo -e "$CNT - Checking for Physical or VM..."
ISVM=$(hostnamectl | grep Chassis)
echo -e "Using $ISVM"
if [[ $ISVM == *"vm"* ]]; then
echo -e "$CWR - 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."
sleep 1
fi
# let the user know that we will use sudo
echo -e "$CNT - This script will run some commands that require sudo. You will be prompted to enter your password."
sleep 1
# give the user an option to exit out
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to continue with the install (y,n) ' CONTINST
if [[ $CONTINST == "Y" || $CONTINST == "y" ]]; then
echo -e "$CNT - Setup starting..."
sudo touch /tmp/hyprv.tmp
else
echo -e "$CNT - This script will now exit, no changes were made to your system."
exit
fi
# find the Nvidia GPU
if lspci -k | grep -A 2 -E "(VGA|3D)" | grep -iq nvidia; then
ISNVIDIA=true
else
ISNVIDIA=false
fi
### Disable wifi powersave mode ###
read -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.\n"
echo -e "[connection]\nwifi.powersave = 2" | sudo tee -a $LOC &>> $INSTLOG
echo -en "$CNT - Restarting NetworkManager service, Please wait."
sleep 2
sudo systemctl restart NetworkManager &>> $INSTLOG
#wait for services to restore (looking at you DNS)
for i in {1..6}
do
echo -n "."
sleep 1
done
echo -en "Done!\n"
sleep 2
echo -e "\e[1A\e[K$COK - NetworkManager restart completed."
fi
#### Check for package manager ####
if [ ! -f /sbin/yay ]; then
echo -en "$CNT - Configuering yay."
git clone https://aur.archlinux.org/yay.git &>> $INSTLOG
cd yay
makepkg -si --noconfirm &>> ../$INSTLOG &
show_progress $!
if [ -f /sbin/yay ]; then
echo -e "\e[1A\e[K$COK - yay configured"
cd ..
# update the yay database
echo -en "$CNT - Updating yay."
yay -Suy --noconfirm &>> $INSTLOG &
show_progress $!
echo -e "\e[1A\e[K$COK - yay updated."
else
# if this is hit then a package is missing, exit to review log
echo -e "\e[1A\e[K$CER - yay install failed, please check the install.log"
exit
fi
fi
### Install all of the above pacakges ####
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to install the packages? (y,n) ' INST
if [[ $INST == "Y" || $INST == "y" ]]; then
# Prep Stage - Bunch of needed items
echo -e "$CNT - Prep Stage - Installing needed components, this may take a while..."
for SOFTWR in ${prep_stage[@]}; do
install_software $SOFTWR
done
# Setup Nvidia if it was found
if [[ "$ISNVIDIA" == true ]]; then
echo -e "$CNT - Nvidia GPU support setup stage, this may take a while..."
for SOFTWR in ${nvidia_stage[@]}; do
install_software $SOFTWR
done
# update config
sudo sed -i 's/MODULES=()/MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)/' /etc/mkinitcpio.conf
sudo mkinitcpio --config /etc/mkinitcpio.conf --generate /boot/initramfs-custom.img
echo -e "options nvidia-drm modeset=1" | sudo tee -a /etc/modprobe.d/nvidia.conf &>> $INSTLOG
fi
# Install the correct hyprland version
echo -e "$CNT - Installing Hyprland, this may take a while..."
if [[ "$ISNVIDIA" == true ]]; then
#check for hyprland and remove it so the -nvidia package can be installed
if yay -Q hyprland &>> /dev/null ; then
yay -R --noconfirm hyprland &>> $INSTLOG &
fi
install_software hyprland-nvidia
else
install_software hyprland
fi
# Stage 1 - main components
echo -e "$CNT - Installing main components, this may take a while..."
for SOFTWR in ${install_stage[@]}; do
install_software $SOFTWR
done
# Start the bluetooth service
echo -e "$CNT - Starting the Bluetooth Service..."
sudo systemctl enable --now 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 &>> $INSTLOG
fi
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to install custom applications from a list? (y,n) ' CUSTOM_APPS
if [[ $CUSTOM_APPS == "Y" || $CUSTOM_APPS == "y" ]]; then
custom_apps
fi
### Copy Config Files ###
read -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..."
# copy the configs directory
cp -R .configs/* ~/.config/
# make files exec
chmod +x ~/.config/hypr/scripts/*
# add the Nvidia env file to the config (if needed)
if [[ "$ISNVIDIA" == true ]]; then
echo -e "\nsource = ~/.config/hypr/nvidia.conf" >> ~/.config/hypr/hyprland.conf
fi
# Copy the SDDM theme
echo -e "$CNT - Setting up the login screen."
sudo tar -xf src/sugar-candy.tar.gz -C /usr/share/sddm/themes/
sudo chown -R $USER:$USER /usr/share/sddm/themes/sugar-candy
sudo mkdir /etc/sddm.conf.d
echo -e "[Theme]\nCurrent=sugar-candy" | sudo tee -a /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 $WLDIR
fi
# stage the .desktop file
sudo cp src/hyprland.desktop /usr/share/wayland-sessions/
# add VScode extensions
echo -e "$CNT - Adding VScode Extensions"
mkdir ~/.vscode
tar -xf src/extensions.tar.gz -C ~/.vscode/
# Font install for Rofi
echo -e "$CNT - Adding Fonts for Rofi"
sudo mkdir $HOME/.local/share/fonts
sudo cp src/Icomoon-Feather.ttf $HOME/.local/share/fonts
fc-cache -fv
fi
### Install the starship shell ###
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to activate the starship shell? (y,n) ' STAR
if [[ $STAR == "Y" || $STAR == "y" ]]; then
# install the starship shell
echo -e "$CNT - Starship, Engage!"
echo -e "$CNT - Updating .bashrc..."
echo -e '\neval "$(starship init bash)"' >> ~/.bashrc
echo -e "$CNT - copying starship config file to ~/.config ..."
cp src/starship.toml ~/.config/
fi
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to activate zsh shell? (y,n) ' ZSH
if [[ $ZSH == "Y" || $ZSH == "y" ]]; then
# install zsh shell
echo -e "$CNT - ZSH, Engage!"
echo -e "$CNT - copying zsh and p10k config file to HOME ..."
# copy zsh and pk10
cp .configs/.p10k.zsh $HOME
cp .configs/.zshrc $HOME
chsh -s $(which zsh)
fi
### Script is done ###
echo -e "$CNT - Script had completed!"
if [[ "$ISNVIDIA" == true ]]; then
echo -e "$CAT - Since we attempted to setup an Nvidia GPU the script will now end and you should reboot.
Please type 'reboot' at the prompt and hit Enter when ready."
exit
fi
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to start Hyprland now? (y,n) ' HYP
if [[ $HYP == "Y" || $HYP == "y" ]]; then
exec sudo systemctl start sddm &>> $INSTLOG
else
exit
fi