updated since many conflicts
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
#!/bin/bash
|
||||
# 💫 https://github.com/JaKooLit 💫 #
|
||||
# Nvidia Stuffs #
|
||||
if [[ $USE_PRESET = [Yy] ]]; then
|
||||
source ./preset.sh
|
||||
fi
|
||||
|
||||
nvidia_pkg=(
|
||||
nvidia-dkms
|
||||
@@ -31,17 +28,17 @@ LOG="Install-Logs/install-$(date +%d-%H%M%S)_nvidia.log"
|
||||
# nvidia stuff
|
||||
printf "${YELLOW} Checking for other hyprland packages and remove if any..${RESET}\n"
|
||||
if pacman -Qs hyprland > /dev/null; then
|
||||
printf "${YELLOW} Hyprland detected. uninstalling to install Hyprland from official repo...${RESET}\n"
|
||||
printf "${YELLOW} Hyprland detected. removing to install Hyprland from official repo...${RESET}\n"
|
||||
for hyprnvi in hyprland-git hyprland-nvidia hyprland-nvidia-git hyprland-nvidia-hidpi-git; do
|
||||
sudo pacman -R --noconfirm "$hyprnvi" 2>/dev/null | tee -a "$LOG" || true
|
||||
done
|
||||
fi
|
||||
|
||||
# Install additional Nvidia packages
|
||||
printf "${YELLOW} Installing Nvidia Packages and Linux headers...\n"
|
||||
printf "${YELLOW} Installing ${SKY_BLUE}Nvidia Packages and Linux headers${RESET}...\n"
|
||||
for krnl in $(cat /usr/lib/modules/*/pkgbase); do
|
||||
for NVIDIA in "${krnl}-headers" "${nvidia_pkg[@]}"; do
|
||||
install_package "$NVIDIA" 2>&1 | tee -a "$LOG"
|
||||
install_package "$NVIDIA" "$LOG"
|
||||
done
|
||||
done
|
||||
|
||||
@@ -50,17 +47,19 @@ if grep -qE '^MODULES=.*nvidia. *nvidia_modeset.*nvidia_uvm.*nvidia_drm' /etc/mk
|
||||
echo "Nvidia modules already included in /etc/mkinitcpio.conf" 2>&1 | tee -a "$LOG"
|
||||
else
|
||||
sudo sed -Ei 's/^(MODULES=\([^\)]*)\)/\1 nvidia nvidia_modeset nvidia_uvm nvidia_drm)/' /etc/mkinitcpio.conf 2>&1 | tee -a "$LOG"
|
||||
echo "Nvidia modules added in /etc/mkinitcpio.conf"
|
||||
echo "${OK} Nvidia modules added in /etc/mkinitcpio.conf"
|
||||
fi
|
||||
|
||||
printf "\n%.0s" {1..1}
|
||||
printf "${INFO} Rebuilding ${YELLOW}Initramfs${RESET}...\n" 2>&1 | tee -a "$LOG"
|
||||
sudo mkinitcpio -P 2>&1 | tee -a "$LOG"
|
||||
|
||||
printf "\n%.0s" {1..3}
|
||||
printf "\n%.0s" {1..1}
|
||||
|
||||
# Additional Nvidia steps
|
||||
NVEA="/etc/modprobe.d/nvidia.conf"
|
||||
if [ -f "$NVEA" ]; then
|
||||
printf "${OK} Seems like nvidia-drm modeset=1 is already added in your system..moving on."
|
||||
printf "${INFO} Seems like ${YELLOW}nvidia_drm modeset=1 fbdev=1${RESET} is already added in your system..moving on."
|
||||
printf "\n"
|
||||
else
|
||||
printf "\n"
|
||||
@@ -71,32 +70,32 @@ fi
|
||||
|
||||
# Additional for GRUB users
|
||||
if [ -f /etc/default/grub ]; then
|
||||
printf "GRUB bootloader detected\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${INFO} ${YELLOW}GRUB${RESET} bootloader detected\n" 2>&1 | tee -a "$LOG"
|
||||
|
||||
# Check if nvidia-drm.modeset=1 is present
|
||||
if ! sudo grep -q "nvidia-drm.modeset=1" /etc/default/grub; then
|
||||
sudo sed -i -e 's/\(GRUB_CMDLINE_LINUX_DEFAULT=".*\)"/\1 nvidia-drm.modeset=1"/' /etc/default/grub
|
||||
printf "nvidia-drm.modeset=1 added to /etc/default/grub\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${OK} nvidia-drm.modeset=1 added to /etc/default/grub\n" 2>&1 | tee -a "$LOG"
|
||||
fi
|
||||
|
||||
# Check if nvidia_drm.fbdev=1 is present
|
||||
if ! sudo grep -q "nvidia_drm.fbdev=1" /etc/default/grub; then
|
||||
sudo sed -i -e 's/\(GRUB_CMDLINE_LINUX_DEFAULT=".*\)"/\1 nvidia_drm.fbdev=1"/' /etc/default/grub
|
||||
printf "nvidia_drm.fbdev=1 added to /etc/default/grub\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${OK} nvidia_drm.fbdev=1 added to /etc/default/grub\n" 2>&1 | tee -a "$LOG"
|
||||
fi
|
||||
|
||||
# Regenerate GRUB configuration
|
||||
if sudo grep -q "nvidia-drm.modeset=1" /etc/default/grub || sudo grep -q "nvidia_drm.fbdev=1" /etc/default/grub; then
|
||||
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||
printf "GRUB configuration regenerated\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${INFO} ${YELLOW}GRUB${RESET} configuration regenerated\n" 2>&1 | tee -a "$LOG"
|
||||
fi
|
||||
|
||||
printf "Additional steps for GRUB completed\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${OK} Additional steps for ${YELLOW}GRUB${RESET} completed\n" 2>&1 | tee -a "$LOG"
|
||||
fi
|
||||
|
||||
# Additional for systemd-boot users
|
||||
if [ -f /boot/loader/loader.conf ]; then
|
||||
printf "systemd-boot bootloader detected\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${INFO} ${YELLOW}systemd-boot${RESET} bootloader detected\n" 2>&1 | tee -a "$LOG"
|
||||
|
||||
backup_count=$(find /boot/loader/entries/ -type f -name "*.conf.bak" | wc -l)
|
||||
conf_count=$(find /boot/loader/entries/ -type f -name "*.conf" | wc -l)
|
||||
@@ -105,43 +104,17 @@ if [ -f /boot/loader/loader.conf ]; then
|
||||
find /boot/loader/entries/ -type f -name "*.conf" | while read imgconf; do
|
||||
# Backup conf
|
||||
sudo cp "$imgconf" "$imgconf.bak"
|
||||
printf "Backup created for systemd-boot loader: %s\n" "$imgconf" 2>&1 | tee -a "$LOG"
|
||||
printf "${INFO} Backup created for systemd-boot loader: %s\n" "$imgconf" 2>&1 | tee -a "$LOG"
|
||||
|
||||
# Clean up options and update with NVIDIA settings
|
||||
sdopt=$(grep -w "^options" "$imgconf" | sed 's/\b nvidia-drm.modeset=[^ ]*\b//g' | sed 's/\b nvidia_drm.fbdev=[^ ]*\b//g')
|
||||
sudo sed -i "/^options/c${sdopt} nvidia-drm.modeset=1 nvidia_drm.fbdev=1" "$imgconf" 2>&1 | tee -a "$LOG"
|
||||
done
|
||||
|
||||
printf "Additional steps for systemd-boot completed\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${OK} Additional steps for ${YELLOW}systemd-boot${RESET} completed\n" 2>&1 | tee -a "$LOG"
|
||||
else
|
||||
printf "systemd-boot is already configured...\n" 2>&1 | tee -a "$LOG"
|
||||
printf "${NOTE} ${YELLOW}systemd-boot${RESET} is already configured...\n" 2>&1 | tee -a "$LOG"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Blacklist nouveau
|
||||
if [[ -z $blacklist_nouveau ]]; then
|
||||
read -n1 -rep "${CAT} Would you like to blacklist nouveau? (y/n)" blacklist_nouveau
|
||||
fi
|
||||
echo
|
||||
if [[ $blacklist_nouveau =~ ^[Yy]$ ]]; then
|
||||
NOUVEAU="/etc/modprobe.d/nouveau.conf"
|
||||
if [ -f "$NOUVEAU" ]; then
|
||||
printf "${OK} Seems like nouveau is already blacklisted..moving on.\n"
|
||||
else
|
||||
echo "blacklist nouveau" | sudo tee -a "$NOUVEAU" 2>&1 | tee -a "$LOG"
|
||||
printf "${NOTE} has been added to $NOUVEAU.\n"
|
||||
printf "\n"
|
||||
|
||||
# To completely blacklist nouveau (See wiki.archlinux.org/title/Kernel_module#Blacklisting 6.1)
|
||||
if [ -f "/etc/modprobe.d/blacklist.conf" ]; then
|
||||
echo "install nouveau /bin/true" | sudo tee -a "/etc/modprobe.d/blacklist.conf" 2>&1 | tee -a "$LOG"
|
||||
else
|
||||
echo "install nouveau /bin/true" | sudo tee "/etc/modprobe.d/blacklist.conf" 2>&1 | tee -a "$LOG"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
printf "${NOTE} Skipping nouveau blacklisting..." 2>&1 | tee -a "$LOG"
|
||||
fi
|
||||
|
||||
clear
|
||||
printf "\n%.0s" {1..2}
|
||||
Reference in New Issue
Block a user