-
Notifications
You must be signed in to change notification settings - Fork 0
/
nvidiainstall.sh
executable file
·669 lines (577 loc) · 21.4 KB
/
nvidiainstall.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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
#!/bin/bash
# //////////////////////////////////////////////////////////////////////////////////////////
# Nvidiainstall by Justus0405
# Source : https://github.com/Justus0405/Nvidiainstall
# License: MIT
# //////////////////////////////////////////////////////////////////////////////////////////
# Version
export VERSION="1.1"
# Color variables
export RED="\e[1;31m"
export GREEN="\e[1;32m"
export YELLOW="\e[1;33m"
export CYAN="\e[1;36m"
export GRAY="\e[1;90m"
export ENDCOLOR="\e[0m"
# Info variables
export SECTION="${GRAY}[${YELLOW}!${GRAY}]${ENDCOLOR}"
export INFO="${GRAY}[${CYAN}i${GRAY}]${ENDCOLOR}"
export SUCCSESS="${GRAY}[${GREEN}✓${GRAY}]${ENDCOLOR}"
export WARNING="${GRAY}[${RED}!${GRAY}]${ENDCOLOR}"
export ERROR="${RED}Error:${ENDCOLOR}"
#########################
# CHECKS #
#########################
check_args() {
# This Function reads the launch arguments
# in a loop and processes each one of them
#
while [[ "$1" != "" ]]; do
case "$1" in
-h | --help)
echo -e "Usage: nvidiainstall.sh [option] [option]"
echo -e ""
echo -e "Options:"
echo -e " -h, --help Show this help message"
echo -e " -d, --debug Run the script with logging"
echo -e " -f, --force Disable nvidia check and force install"
exit 0
;;
-d | --debug)
export LOG_FILE="/var/log/nvidia_install.log"
export DEBUG_MODE=true
;;
-f | --force)
export FORCED_MODE=true
;;
*)
echo -e "Unknown option: $1"
echo -e "Use -h or --help for help."
exit 0
;;
esac
shift
done
}
check_sudo() {
#
# Checks EUID to see if the script is running as sudo
#
if [[ "$EUID" -ne 0 ]]; then
echo -e "${ERROR} This script must be run as root. Use sudo."
exit 1
fi
# Looks if the root user is permitted to execute
# commands as sudo, this is needed because executing
# commands with privilges in a bash script is a bit weird
# or it may be just a skill issue ¯\_(ツ)_/¯
if ! groups root | grep -q "\bwheel\b"; then
echo -e "${INFO} Root is not in the wheel group. Adding root to the wheel group."
usermod -aG wheel root || {
echo -e "${ERROR} Failed to add root to the wheel group."
exit 1
}
echo -e "${INFO} Root has been successfully added to the wheel group."
else
echo -e "${INFO} Root is already in the wheel group."
fi
}
check_nvidia() {
# Looks for any PCI device with the name "Nvidia" in it
# This is to prevent something idk, saftey and such
# stuff
if lspci | grep -i nvidia &>/dev/null; then
echo -e "${GREEN}NVIDIA card detected.${ENDCOLOR}"
else
echo -e "${ERROR} No NVIDIA card detected."
exit 1
fi
}
#########################
# TERMINAL INTERFACE #
#########################
show_menu() {
# This is the main function with renders the selection menu
# Waiting for the input of the user for running further functions
# The function runs itself at the end ensuring coming back to it
# when the selected option finished running
clear
echo -e "\t┌──────────────────────────────────────────────────┐"
if [[ "$DEBUG_MODE" = true ]]; then
echo -e "\t│ [i] Debug Mode Enabled │"
fi
if [[ "$FORCED_MODE" = true ]]; then
echo -e "\t│ [i] Forced Mode Enabled │"
fi
echo -e "\t│ │"
echo -e "\t│ Choose option: │"
echo -e "\t│ │"
echo -e "\t│ [1] Install │"
echo -e "\t│ [2] Uninstall │"
echo -e "\t│ [3] Device Information │"
echo -e "\t│ [4] About │"
echo -e "\t│ │"
echo -e "\t├──────────────────────────────────────────────────┤"
echo -e "\t│ [0] Quit │"
echo -e "\t└──────────────────────────────────────────────────┘"
echo -e ""
echo -e "\t${GREEN}Choose a menu option using your keyboard [1,2,3,4,0]${ENDCOLOR}"
# Use -n1 to read a single character without the need to press enter
read -rsn1 option
case "$option" in
"1")
conrfirm_installation
;;
"2")
confirm_uninstallation
;;
"3")
show_device_information
;;
"4")
show_about
;;
"0")
clear
exit 0
;;
esac
# Loop back to menu after an option is handled
show_menu
}
conrfirm_installation() {
# This is just a sanity check for the user
# Also used to initiate the logging if
# DEBUG_MODE is set to true
# The weird [yY][eE][sS]|[yY] syntax makes it
# possible to answer either with y or yes in
# any capitalization
clear
echo -e "${INFO} This script will install NVIDIA drivers and modify system configurations."
echo -e "${WARNING} Note: This script only supports generation Maxwell or newer, Use at your own risk!"
read -rp "Do you want to proceed? (y/N): " confirm
case "$confirm" in
[yY][eE][sS] | [yY])
echo -e "${GREEN}Proceeding with installation...${ENDCOLOR}"
if [[ "$DEBUG_MODE" = true ]]; then
echo -e "${INFO} Started logging at $LOG_FILE${ENDCOLOR}"
exec > >(tee -i "$LOG_FILE") 2>&1
fi
installation_steps
;;
*)
echo -e "${RED}Installation cancelled.${ENDCOLOR}"
exit 0
;;
esac
}
installation_steps() {
# Just a simple function handling each steps because
# handling it everywere else looked ugly
#
# Step 1
update_system
# Step 2
check_kernel_headers
# Step 3
install_nvidia_packages
# Step 4
configure_mkinitcpio
# Step 5
configure_modprobe
# Step 6
configure_grub_default
# Step 7
regenerate_initramfs
# Step 8
update_grub_config
# Step 9
confirm_reboot
}
confirm_uninstallation() {
# This is just a sanity check for the user, Part 2
# Also used to initiate the logging if
# DEBUG_MODE is set to true
# The weird [yY][eE][sS]|[yY] syntax makes it
# possible to answer either with y or yes in
# any capitalization
clear
echo -e "${WARNING} This will completely uninstall all NVIDIA drivers and modify system configurations."
echo -e "${WARNING} Note: This script only supports the arch repo not the AUR, Use at your own risk!"
read -rp "Do you want to proceed? (y/N): " confirm
case "$confirm" in
[yY][eE][sS] | [yY])
echo -e "${GREEN}Proceeding with uninstallation...${ENDCOLOR}"
if [[ "$DEBUG_MODE" = true ]]; then
echo -e "${INFO} Started logging at $LOG_FILE${ENDCOLOR}"
exec > >(tee -i "$LOG_FILE") 2>&1
fi
uninstallation_steps
;;
*)
echo -e "${RED}Uninstallation cancelled.${ENDCOLOR}"
exit 0
;;
esac
}
uninstallation_steps() {
# Just a simple function handling each steps because
# handling it everywere else looked ugly, Part 2
#
# Step 1
remove_nvidia_packages
# Step 2
remove_mkinitcpio
# Step 3
remove_modprobe
# Step 4
remove_grub_default
# Step 5
regenerate_initramfs
# Step 6
update_grub_config
# Step 7
confirm_reboot
}
show_device_information() {
# Looks for any PCI device with the name "Nvidia" in it
# and lists them here
#
clear
echo -e ""
echo -e "\tDevice Information:"
echo -e ""
GPU=$(lspci | grep -i 'nvidia' || true)
if [[ -z "$GPU" ]]; then
GPU="No NVIDIA card detected"
fi
echo -e "$GPU"
echo -e ""
echo -e "\t${GREEN}Press any button to return${ENDCOLOR}"
# Use -n1 to read a single character without the need to press enter
read -rsn1 option
case "$option" in
*) ;;
esac
}
show_about() {
# Just a bit of info
# Also fetches the list of contributers regarding this project and
# displays them in a list
github_response=$(curl -s "https://api.github.com/repos/Justus0405/Nvidiainstall/contributors")
clear
echo -e ""
echo -e "\tAbout Nvidiainstall:"
echo -e ""
echo -e "\tVersion: $VERSION"
echo -e "\tAuthor : Justus0405"
echo -e "\tSource : https://github.com/Justus0405/Nvidiainstall"
echo -e "\tLicense: MIT"
echo -e "\tContributers:"
echo "$github_response" | grep '"login":' | awk -F '"' '{print $4}' | while read -r contributors; do
echo -e "\t\t\e[0;35m${contributors}\e[m"
done
echo -e ""
echo -e "\t${GREEN}Press any button to return${ENDCOLOR}"
# Use -n1 to read a single character without the need to press enter
read -rsn1 option
case "$option" in
*) ;;
esac
}
#########################
# INSTALLATION STEPS #
#########################
update_system() {
#
# Stay up to date folks
#
echo -e "${SECTION} Updating system..."
sudo pacman -Syyu || {
echo -e "${ERROR} Could not update system."
exit 1
}
echo -e "${SUCCSESS} System updated."
}
check_kernel_headers() {
# Check the installed kernel and installs
# the associated headers, this is needed
# for the kernel to load the nvidia modules
echo -e "${SECTION} Installing kernel modules..."
kernel_version=$(uname -r)
if [[ "$kernel_version" == *"zen"* ]]; then
echo -e "${INFO} Detected kernel: zen"
sudo pacman -S --needed --noconfirm linux-zen-headers || {
echo -e "${ERROR} Could not install kernel modules."
exit 1
}
elif [[ "$kernel_version" == *"lts"* ]]; then
echo -e "${INFO} Detected kernel: lts"
sudo pacman -S --needed --noconfirm linux-lts-headers || {
echo -e "${ERROR} Could not install kernel modules."
exit 1
}
elif [[ "$kernel_version" == *"hardened"* ]]; then
echo -e "${INFO} Detected kernel: hardened"
sudo pacman -S --needed --noconfirm linux-hardened-headers || {
echo -e "${ERROR} Could not install kernel modules."
exit 1
}
else
echo -e "${INFO} Detected kernel: regular"
sudo pacman -S --needed --noconfirm linux-headers || {
echo -e "${ERROR} Could not install kernel modules."
exit 1
}
fi
echo -e "${SUCCSESS} Kernel modules installed."
}
install_nvidia_packages() {
#
# Install the nvidia drivers and needed dependencies if not present
#
echo -e "${SECTION} Installing NVIDIA packages..."
sudo pacman -S --needed --noconfirm nvidia-dkms libglvnd nvidia-utils opencl-nvidia nvidia-settings lib32-nvidia-utils lib32-opencl-nvidia egl-wayland || {
echo -e "${ERROR} Could not install Nvidia packages."
exit 1
}
echo -e "${SUCCSESS} Nvidia packages installed."
}
configure_mkinitcpio() {
# This was just pure insanity to impliment with the intent
# of not breaking previous configurations (But it works :3)
# This is for adding the nvidia modules to the /etc/mkinitcpio.conf file
# Firstly it creates a backup of the original file
# Then it removes any lines that are commented out and contain nothing (Not necessary but pretty)
# Then removes any previously added nvidia modules, this could fix previously wrong configurations
# Ensures the () dont have any spaces at the beginning and at the end
# Then the modules get added in the correct formatting and order without deleting previous modules
# not related to nvidia
# At the end the kms hook gets removed, which is a recommeded step because it disables any other
# non-nvidia GPU
echo -e "${SECTION} Configuring mkinitcpio..."
MKINITCPIO_CONF="/etc/mkinitcpio.conf"
if [[ -f "$MKINITCPIO_CONF" ]]; then
# Backup existing configuration file if it exists
sudo cp "$MKINITCPIO_CONF" "$MKINITCPIO_CONF.bak"
echo -e "${INFO} Backup of $MKINITCPIO_CONF created."
# Remove any lines that are commented out and contain nothing
echo -e "${INFO} Cleaning up $MKINITCPIO_CONF structure..."
sudo sed -i '/^#/d;/^$/d' "$MKINITCPIO_CONF"
if grep -q 'MODULES=.*nvidia' "$MKINITCPIO_CONF"; then
# Remove any occurrences of nvidia-related modules
echo -e "${INFO} Cleaning up existing NVIDIA modules..."
sudo sed -i 's/\b\(nvidia\|nvidia_modeset\|nvidia_uvm\|nvidia_drm\)\b//g' "$MKINITCPIO_CONF"
# Ensure exactly one space between words and no space after '(' or before ')'
sudo sed -i 's/ ( /(/g; s/ )/)/g; s/( */(/; s/ *)/)/; s/ \+/ /g' "$MKINITCPIO_CONF"
fi
# Now, append the NVIDIA modules in the correct order if they are not already there
if ! grep -q 'MODULES=.*nvidia nvidia_modeset nvidia_uvm nvidia_drm' "$MKINITCPIO_CONF"; then
echo -e "${INFO} Adding NVIDIA modules..."
sudo sed -i 's/^MODULES=(\([^)]*\))/MODULES=(\1 nvidia nvidia_modeset nvidia_uvm nvidia_drm)/' "$MKINITCPIO_CONF"
# Ensure exactly one space between words and no space after '(' or before ')'
sudo sed -i 's/ ( /(/g; s/ )/)/g; s/( */(/; s/ *)/)/; s/ \+/ /g' "$MKINITCPIO_CONF"
else
echo -e "${INFO} NVIDIA modules are already present in the correct order."
fi
# Removing kms hook if it exists
if grep -q '\bkms\b' "$MKINITCPIO_CONF"; then
echo -e "${INFO} Removing kms hook..."
sudo sed -i 's/\bkms \b//g' "$MKINITCPIO_CONF"
else
echo -e "${INFO} kms hook is not present."
fi
echo -e "${SUCCSESS} $MKINITCPIO_CONF updated."
else
echo -e "${ERROR} $MKINITCPIO_CONF not found."
exit 1
fi
}
configure_modprobe() {
# This function looks for an nvidia.conf file at /etc/modprobe.d/
# If it exists, backs it up and creates a new one with the content
# "options nvidia_drm modeset=1 fbdev=1" straight from Hyprland Wiki
# This isnt needed but still good for compatibility
echo -e "${SECTION} Creating Nvidia modprobe file..."
NVIDIA_CONF="/etc/modprobe.d/nvidia.conf"
# Backup existing configuration file if it exists
if [[ -f "$NVIDIA_CONF" ]]; then
sudo cp "$NVIDIA_CONF" "${NVIDIA_CONF}.bak"
echo -e "${INFO} Backup of $NVIDIA_CONF created."
fi
# Create new configuration file
echo -e "${INFO} Creating $NVIDIA_CONF..."
echo "options nvidia_drm modeset=1 fbdev=1" | sudo tee "$NVIDIA_CONF" >/dev/null || {
echo -e "${ERROR} Failed to create NVIDIA modprobe file."
exit 1
}
echo -e "${SUCCSESS} NVIDIA modprobe file created."
}
configure_grub_default() {
# Function to add "nvidia_drm.modeset=1" to /etc/default/grub
# only if it not exists, also backs up the grub config before
# making these changes
# The weird sed syntax ensures that the argument only gets added
# and not replacing the line, keeping previous configuration safe
echo -e "${SECTION} Configuring GRUB default..."
GRUB_CONF="/etc/default/grub"
if [[ -f "$GRUB_CONF" ]]; then
# Backup existing configuration file if it exists
sudo cp "$GRUB_CONF" "$GRUB_CONF.bak"
echo -e "${INFO} Backup of $GRUB_CONF created."
# Update the GRUB configuration
echo -e "${INFO} Adding nvidia modeset to $GRUB_CONF..."
sudo sed -i '/GRUB_CMDLINE_LINUX_DEFAULT=/!b;/nvidia_drm.modeset=1/!s/\(GRUB_CMDLINE_LINUX_DEFAULT="[^"]*\)/\1 nvidia_drm.modeset=1/' "$GRUB_CONF"
echo -e "${SUCCSESS} $GRUB_CONF updated."
else
echo -e "${ERROR} $GRUB_CONF not found."
exit 1
fi
}
regenerate_initramfs() {
# Regenerates the initramfs
# to load the nvidia modules
# Prepare for high CPU usage
echo -e "${SECTION} Regenerating initramfs..."
sudo mkinitcpio -P || {
echo -e "${ERROR} Failed to regenerate the initramfs."
exit 1
}
echo -e "${SUCCSESS} initramfs regenerated."
}
update_grub_config() {
# Updates the grub config at /boot/grub/grub.cfg
# After /etc/default/grub was changed
#
BOOT_CONF="/boot/grub/grub.cfg"
echo -e "${SECTION} Updating GRUB config..."
sudo grub-mkconfig -o "$BOOT_CONF" || {
echo -e "${ERROR} Failed to update $BOOT_CONF."
exit 1
}
echo -e "${SUCCSESS} $BOOT_CONF updated."
}
confirm_reboot() {
# Asks the user to reboot to apply changes
# properly, if no is selected the script
# will return to show_menu
echo -e ""
echo -e "${GREEN}Action complete.${ENDCOLOR}"
if [[ "$DEBUG_MODE" = true ]]; then
echo -e "${INFO} Log saved at $LOG_FILE${ENDCOLOR}"
fi
read -rp "Would you like to reboot now? (y/N): " reboot_now
case "$reboot_now" in
[yY][eE][sS] | [yY])
sudo reboot now
;;
*)
echo -e "${INFO} Please reboot your system later to apply changes."
echo -e ""
echo -e "\t${GREEN}Press any button to return${ENDCOLOR}"
# Use -n1 to read a single character without the need to press enter
read -rsn1 option
case "$option" in
*) ;;
esac
;;
esac
}
#########################
# UNINSTALLATION STEPS #
#########################
remove_nvidia_packages() {
#
# Uninstall the nvidia drivers, configs and unused dependencies
#
echo -e "${SECTION} Uninstalling Nvidia packages..."
sudo pacman -Rn nvidia-dkms nvidia-settings || {
echo -e "${ERROR} Could not uninstall Nvidia packages."
exit 1
}
echo -e "${SUCCSESS} Nvidia packages uninstalled."
}
remove_mkinitcpio() {
# Same as the configure_mkinitcpio() function but without
# adding the nvidia modules
# Adds back the kms hook
echo -e "${SECTION} Removing mkinitcpio modules..."
MKINITCPIO_CONF="/etc/mkinitcpio.conf"
if [[ -f "$MKINITCPIO_CONF" ]]; then
# Backup existing configuration file if it exists
sudo cp "$MKINITCPIO_CONF" "$MKINITCPIO_CONF.bak-uninstall"
echo -e "${INFO} Backup of $MKINITCPIO_CONF created."
# Remove any lines that are commented out and contain nothing
echo -e "${INFO} Cleaning up $MKINITCPIO_CONF structure..."
sudo sed -i '/^#/d;/^$/d' "$MKINITCPIO_CONF"
if grep -q 'MODULES=.*nvidia' "$MKINITCPIO_CONF"; then
# Remove any occurrences of nvidia-related modules
echo -e "${INFO} Removing NVIDIA modules..."
sudo sed -i 's/\b\(nvidia\|nvidia_modeset\|nvidia_uvm\|nvidia_drm\)\b//g' "$MKINITCPIO_CONF"
# Ensure exactly one space between words and no space after '(' or before ')'
sudo sed -i 's/ ( /(/g; s/ )/)/g; s/( */(/; s/ *)/)/; s/ \+/ /g' "$MKINITCPIO_CONF"
fi
# Add back the kms hook
if grep -q '\bkms\b' "$MKINITCPIO_CONF"; then
echo -e "${INFO} kms hook is already present."
else
echo -e "${INFO} Adding kms hook..."
sudo sed -i 's/modconf/& kms/' "$MKINITCPIO_CONF"
fi
echo -e "${SUCCSESS} $MKINITCPIO_CONF updated."
else
echo -e "${ERROR} $MKINITCPIO_CONF not found."
exit 1
fi
}
remove_modprobe() {
# Creates a backup of the /etc/modprobe.d/nvidia.conf file
# and deletes the original one
#
echo -e "${SECTION} Deleting Nvidia modprobe file..."
NVIDIA_CONF="/etc/modprobe.d/nvidia.conf"
# Backup existing configuration file if it exists
if [[ -f "$NVIDIA_CONF" ]]; then
sudo cp "$NVIDIA_CONF" "${NVIDIA_CONF}.bak-uninstall"
echo -e "${INFO} Backup of $NVIDIA_CONF created."
fi
# Delete configuration file
sudo rm -f "$NVIDIA_CONF" || {
echo -e "${WARNING} Failed to delete Nvidia modprobe file."
}
echo -e "${SUCCSESS} NVIDIA modprobe file deleted."
}
remove_grub_default() {
# Creates a backup of the /etc/default/grub file
# Removes nvidia_drm.modeset=1 from
# GRUB_CMDLINE_LINUX
echo -e "${SECTION} Configuring GRUB default..."
GRUB_CONF="/etc/default/grub"
if [[ -f "$GRUB_CONF" ]]; then
# Backup existing configuration file if it exists
sudo cp "$GRUB_CONF" "$GRUB_CONF.bak-uninstall"
echo -e "${INFO} Backup of $GRUB_CONF created."
# Remove nvidia_drm.modeset=1 from GRUB_CMDLINE_LINUX
echo -e "${INFO} Removing nvidia modeset from $GRUB_CONF..."
sudo sed -i 's/nvidia_drm\.modeset=1//g' "$GRUB_CONF"
echo -e "${SUCCSESS} $GRUB_CONF updated."
else
echo -e "${ERROR} $GRUB_CONF not found."
exit 1
fi
}
#########################
# PROGRAMM START #
#########################
# Step 1: Set up trap for SIGINT (CTRL+C)
trap 'echo -e "${RED}Exited${ENDCOLOR}"; exit 0' SIGINT
# Step 2: Check launch arguments for extra functionality
check_args "$@"
# Step 3: Check if running as sudo
check_sudo
# Step 4: Check if NVIDIA card is present
if [[ "$FORCED_MODE" != true ]]; then
check_nvidia
fi
# Step 5: Show selection menu
show_menu