-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
install.sh
executable file
·303 lines (246 loc) · 8.29 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
#!/bin/bash
# https://github.com/JaKooLit
# Check if running as root. If root, script will exit
if [[ $EUID -eq 0 ]]; then
echo "This script should not be executed as root! Exiting......."
exit 1
fi
clear
# Function to check if the system is Ubuntu
is_ubuntu() {
# Check for 'Ubuntu' in /etc/os-release
if grep -q 'Ubuntu' /etc/os-release; then
return 0
fi
return 1
}
# Check if the system is Ubuntu
if is_ubuntu; then
echo "This script is NOT intended for Ubuntu / Ubuntu Based. Refer to README for the correct link for Ubuntu-Hyprland project."
exit 1
fi
clear
# ASCII art
printf "\n%.0s" {1..3}
echo " | _. |/ _ _ | o _|_ "
echo " \_| (_| o |\ (_) (_) |_ | |_ "
printf "\n%.0s" {1..2}
# Welcome message
echo "$(tput setaf 6)Welcome to JaKooLit's Debian Trixie/SID Hyprland Install Script!$(tput sgr0)"
echo
echo "$(tput setaf 166)ATTENTION: Run a full system update and reboot first!! (Highly Recommended)$(tput sgr0)"
echo
echo "$(tput setaf 3)NOTE: You will be required to answer some questions during the installation!$(tput sgr0)"
echo
echo "$(tput setaf 3)NOTE: If you are installing on a VM, ensure to enable 3D acceleration; otherwise, Hyprland won't start!$(tput sgr0)"
echo
# Prompt user to proceed
read -p "$(tput setaf 6)Would you like to proceed? (y/n): $(tput sgr0)" proceed
if [[ "$proceed" != "y" ]]; then
echo "Installation aborted."
exit 1
fi
read -p "$(tput setaf 6)Have you edited your /etc/apt/sources.list? [Very Important] (y/n): $(tput sgr0)" proceed2
if [ "$proceed2" != "y" ]; then
echo "Installation aborted Kindly edit your sources.list first. Refer to readme."
exit 1
fi
# Create Directory for Install Logs
if [ ! -d Install-Logs ]; then
mkdir Install-Logs
fi
# Set some colors for output messages
OK="$(tput setaf 2)[OK]$(tput sgr0)"
ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)"
NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)"
WARN="$(tput setaf 5)[WARN]$(tput sgr0)"
CAT="$(tput setaf 6)[ACTION]$(tput sgr0)"
ORANGE=$(tput setaf 166)
YELLOW=$(tput setaf 3)
RESET=$(tput sgr0)
# Function to colorize prompts
colorize_prompt() {
local color="$1"
local message="$2"
echo -n "${color}${message}$(tput sgr0)"
}
# Set the name of the log file to include the current date and time
LOG="install-$(date +%d-%H%M%S).log"
# Initialize variables to store user responses
bluetooth=""
dots=""
gtk_themes=""
nvidia=""
nwg=""
rog=""
sddm=""
thunar=""
xdph=""
zsh=""
# Export PKG_CONFIG_PATH for libinput
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
# Define the directory where your scripts are located
script_directory=install-scripts
# Function to ask a yes/no question and set the response in a variable
ask_yes_no() {
while true; do
read -p "$(colorize_prompt "$CAT" "$1 (y/n): ")" choice
case "$choice" in
[Yy]* ) eval "$2='Y'"; return 0;;
[Nn]* ) eval "$2='N'"; return 1;;
* ) echo "Please answer with y or n.";;
esac
done
}
# Function to ask a custom question with specific options and set the response in a variable
ask_custom_option() {
local prompt="$1"
local valid_options="$2"
local response_var="$3"
while true; do
read -p "$(colorize_prompt "$CAT" "$prompt ($valid_options): ")" choice
if [[ " $valid_options " == *" $choice "* ]]; then
eval "$response_var='$choice'"
return 0
else
echo "Please choose one of the provided options: $valid_options"
fi
done
}
# Function to execute a script if it exists and make it executable
execute_script() {
local script="$1"
local script_path="$script_directory/$script"
if [ -f "$script_path" ]; then
chmod +x "$script_path"
if [ -x "$script_path" ]; then
"$script_path"
else
echo "Failed to make script '$script' executable."
fi
else
echo "Script '$script' not found in '$script_directory'."
fi
}
# Collect user responses to all questions
printf "\n"
ask_yes_no "-Do you have any nvidia gpu in your system?" nvidia
printf "\n"
ask_yes_no "-Install GTK themes (required for Dark/Light function)?" gtk_themes
printf "\n"
ask_yes_no "-Do you want to configure Bluetooth?" bluetooth
printf "\n"
ask_yes_no "-Do you want to install Thunar file manager?" thunar
printf "\n"
ask_yes_no "-Install & configure SDDM log-in Manager plus (OPTIONAL) SDDM Theme?" sddm
printf "\n"
ask_yes_no "-Install XDG-DESKTOP-PORTAL-HYPRLAND? (For proper Screen Share ie OBS)" xdph
printf "\n"
ask_yes_no "-Install zsh & oh-my-zsh plus (OPTIONAL) pokemon-colorscripts for tty?" zsh
printf "\n"
# 14 Sep 2024, now in Debian repo
#ask_yes_no "-Install nwg-look? (a GTK Theming app - lxappearance-like) WARN! This Package Takes long time to build!" nwg
#printf "\n"
ask_yes_no "-Installing on Asus ROG Laptops?" rog
printf "\n"
ask_yes_no "-Do you want to download and install pre-configured Hyprland-dotfiles?" dots
printf "\n"
# Ensuring all in the scripts folder are made executable
chmod +x install-scripts/*
printf "\n%.0s" {1..3}
# check if any known login managers are active when users choose to install sddm
if [ "$sddm" == "Y" ]; then
# List of services to check
services=("gdm.service" "gdm3.service" "lightdm.service" "xdm.service" "lxdm.service")
# Loop through each service
for svc in "${services[@]}"; do
if systemctl is-active --quiet "$svc"; then
echo "${ERROR} $svc is active. Please stop or disable it first or do not choose SDDM to install."
echo "${NOTE} If you have GDM, no need to install SDDM. GDM will work fine as Login Manager for Hyprland."
printf "\n%.0s" {1..3}
exit 1
fi
done
fi
sleep 1
sudo apt update
# execute pre clean up
execute_script "02-pre-cleanup.sh"
# Install hyprland packages
execute_script "00-dependencies.sh"
execute_script "01-hypr-pkgs.sh"
execute_script "fonts.sh"
execute_script "wallust.sh"
#execute_script "imagemagick.sh" #this is for compiling from source. 07 Sep 2024
execute_script "swww.sh"
execute_script "rofi-wayland.sh"
sleep 1
execute_script "ags.sh"
execute_script "hyprland.sh"
execute_script "hyprlock.sh"
execute_script "hypridle.sh"
# execute_script "waybar-git.sh" only if waybar on repo is old
if [ "$nvidia" == "Y" ]; then
execute_script "nvidia.sh"
fi
if [ "$gtk_themes" == "Y" ]; then
execute_script "gtk_themes.sh"
fi
if [ "$bluetooth" == "Y" ]; then
execute_script "bluetooth.sh"
fi
if [ "$thunar" == "Y" ]; then
execute_script "thunar.sh"
fi
if [ "$sddm" == "Y" ]; then
execute_script "sddm.sh"
fi
if [ "$xdph" == "Y" ]; then
execute_script "xdph.sh"
fi
if [ "$zsh" == "Y" ]; then
execute_script "zsh.sh"
fi
#if [ "$nwg" == "Y" ]; then
# execute_script "nwg-look.sh"
#fi
if [ "$rog" == "Y" ]; then
execute_script "rog.sh"
fi
execute_script "InputGroup.sh"
if [ "$dots" == "Y" ]; then
execute_script "dotfiles.sh"
fi
# Clean up
printf "\n${OK} performing some clean up.\n"
if [ -e "JetBrainsMono.tar.xz" ]; then
echo "JetBrainsMono.tar.xz found. Deleting..."
rm JetBrainsMono.tar.xz
echo "JetBrainsMono.tar.xz deleted successfully."
fi
clear
printf "\n%.0s" {1..2}
# final check essential packages if it is installed
execute_script "03-Final-Check.sh"
printf "\n%.0s" {1..1}
# Check if either hyprland or hyprland-git is installed
if dpkg -l | grep -qw hyprland; then
printf "\n${OK} Hyprland is installed. However, some essential packages may not be installed Please see above!"
printf "\n${CAT} Ignore this message if it states 'All essential packages are installed.'\n"
sleep 2
printf "\n${NOTE} You can start Hyprland by typing 'Hyprland' (IF SDDM is not installed) (note the capital H!).\n"
printf "\n${NOTE} However, it is highly recommended to reboot your system.\n\n"
# Prompt user to reboot
read -rp "${CAT} Would you like to reboot now? (y/n): " HYP
# Check if the user answered 'y' or 'Y'
if [[ "$HYP" =~ ^[Yy]$ ]]; then
if [[ "$nvidia" == "Y" ]]; then
echo "${NOTE} NVIDIA GPU detected. Rebooting the system..."
fi
systemctl reboot
fi
else
# Print error message if neither package is installed
printf "\n${WARN} Hyprland failed to install. Please check 00_CHECK-time_installed.log and other files Install-Logs/ directory...\n\n"
exit 1
fi