Skip to content

Commit 7eea1d7

Browse files
authored
Merge pull request #197 from JaKooLit/development
Development to Main
2 parents b3a0055 + dac6c37 commit 7eea1d7

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

CHANGELOGS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Changelogs
22

3+
## 29 Jan 2025
4+
- enhanced nvidia.sh to add additional systemd-bootloader entries for nvidia
5+
36
## 16 Jan 2025
47
- updated nvidia.sh to install non-git libva-nvidia-driver
58

install-scripts/Global_functions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ install_package_pacman() {
2828
else
2929
# Package not installed
3030
echo -e "${NOTE} Installing $1 ..."
31-
sudo pacman -S --noconfirm "$1" 2>&1 | tee -a "$LOG"
31+
sudo pacman -S --noconfirm --needed "$1" 2>&1 | tee -a "$LOG"
3232
# Making sure package is installed
3333
if pacman -Q "$1" &>/dev/null ; then
3434
echo -e "\e[1A\e[K${OK} Package ${YELLOW}$1${RESET} has been successfully installed!"
@@ -51,7 +51,7 @@ install_package() {
5151
else
5252
# Package not installed
5353
echo -e "${NOTE} Installing $1 ..."
54-
$ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG"
54+
$ISAUR -S --noconfirm --needed "$1" 2>&1 | tee -a "$LOG"
5555
# Making sure package is installed
5656
if $ISAUR -Q "$1" &>> /dev/null ; then
5757
echo -e "\e[1A\e[K${OK} Package ${YELLOW}$1${RESET} has been successfully installed!"

install-scripts/nvidia.sh

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,55 @@ else
7070
fi
7171

7272
# Additional for GRUB users
73-
# Check if /etc/default/grub exists
7473
if [ -f /etc/default/grub ]; then
74+
printf "GRUB bootloader detected\n" 2>&1 | tee -a "$LOG"
75+
7576
# Check if nvidia-drm.modeset=1 is present
7677
if ! sudo grep -q "nvidia-drm.modeset=1" /etc/default/grub; then
7778
sudo sed -i -e 's/\(GRUB_CMDLINE_LINUX_DEFAULT=".*\)"/\1 nvidia-drm.modeset=1"/' /etc/default/grub
78-
echo "nvidia-drm.modeset=1 added to /etc/default/grub" 2>&1 | tee -a "$LOG"
79+
printf "nvidia-drm.modeset=1 added to /etc/default/grub\n" 2>&1 | tee -a "$LOG"
7980
fi
8081

8182
# Check if nvidia_drm.fbdev=1 is present
8283
if ! sudo grep -q "nvidia_drm.fbdev=1" /etc/default/grub; then
8384
sudo sed -i -e 's/\(GRUB_CMDLINE_LINUX_DEFAULT=".*\)"/\1 nvidia_drm.fbdev=1"/' /etc/default/grub
84-
echo "nvidia_drm.fbdev=1 added to /etc/default/grub" 2>&1 | tee -a "$LOG"
85+
printf "nvidia_drm.fbdev=1 added to /etc/default/grub\n" 2>&1 | tee -a "$LOG"
8586
fi
8687

8788
# Regenerate GRUB configuration
8889
if sudo grep -q "nvidia-drm.modeset=1" /etc/default/grub || sudo grep -q "nvidia_drm.fbdev=1" /etc/default/grub; then
89-
sudo grub-mkconfig -o /boot/grub/grub.cfg
90+
sudo grub-mkconfig -o /boot/grub/grub.cfg
91+
printf "GRUB configuration regenerated\n" 2>&1 | tee -a "$LOG"
9092
fi
93+
94+
printf "Additional steps for GRUB completed\n" 2>&1 | tee -a "$LOG"
95+
fi
9196

92-
else
93-
echo "/etc/default/grub does not exist"
97+
# Additional for systemd-boot users
98+
if [ -f /boot/loader/loader.conf ]; then
99+
printf "systemd-boot bootloader detected\n" 2>&1 | tee -a "$LOG"
100+
101+
backup_count=$(find /boot/loader/entries/ -type f -name "*.conf.bak" | wc -l)
102+
conf_count=$(find /boot/loader/entries/ -type f -name "*.conf" | wc -l)
103+
104+
if [ "$backup_count" -ne "$conf_count" ]; then
105+
find /boot/loader/entries/ -type f -name "*.conf" | while read imgconf; do
106+
# Backup conf
107+
sudo cp "$imgconf" "$imgconf.bak"
108+
printf "Backup created for systemd-boot loader: %s\n" "$imgconf" 2>&1 | tee -a "$LOG"
109+
110+
# Clean up options and update with NVIDIA settings
111+
sdopt=$(grep -w "^options" "$imgconf" | sed 's/\b nvidia-drm.modeset=[^ ]*\b//g' | sed 's/\b nvidia_drm.fbdev=[^ ]*\b//g')
112+
sudo sed -i "/^options/c${sdopt} nvidia-drm.modeset=1 nvidia_drm.fbdev=1" "$imgconf" 2>&1 | tee -a "$LOG"
113+
done
114+
115+
printf "Additional steps for systemd-boot completed\n" 2>&1 | tee -a "$LOG"
116+
else
117+
printf "systemd-boot is already configured...\n" 2>&1 | tee -a "$LOG"
118+
fi
94119
fi
95120

121+
96122
# Blacklist nouveau
97123
if [[ -z $blacklist_nouveau ]]; then
98124
read -n1 -rep "${CAT} Would you like to blacklist nouveau? (y/n)" blacklist_nouveau

0 commit comments

Comments
 (0)