From 67d6c1524e9770dfec3349f4734a8fc6fb080d5f Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Wed, 29 Jan 2025 20:59:22 +0900 Subject: [PATCH] enhance global function and added systemd boot entries --- install-scripts/Global_functions.sh | 4 ++-- install-scripts/nvidia.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/install-scripts/Global_functions.sh b/install-scripts/Global_functions.sh index 3393fae..7b4edf4 100755 --- a/install-scripts/Global_functions.sh +++ b/install-scripts/Global_functions.sh @@ -28,7 +28,7 @@ install_package_pacman() { else # Package not installed echo -e "${NOTE} Installing $1 ..." - sudo pacman -S --noconfirm "$1" 2>&1 | tee -a "$LOG" + sudo pacman -S --noconfirm --needed "$1" 2>&1 | tee -a "$LOG" # Making sure package is installed if pacman -Q "$1" &>/dev/null ; then echo -e "\e[1A\e[K${OK} Package ${YELLOW}$1${RESET} has been successfully installed!" @@ -51,7 +51,7 @@ install_package() { else # Package not installed echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" + $ISAUR -S --noconfirm --needed "$1" 2>&1 | tee -a "$LOG" # Making sure package is installed if $ISAUR -Q "$1" &>> /dev/null ; then echo -e "\e[1A\e[K${OK} Package ${YELLOW}$1${RESET} has been successfully installed!" diff --git a/install-scripts/nvidia.sh b/install-scripts/nvidia.sh index cef032f..c280d16 100755 --- a/install-scripts/nvidia.sh +++ b/install-scripts/nvidia.sh @@ -93,6 +93,25 @@ else echo "/etc/default/grub does not exist" fi +# Additional for systemd-boot users +if [ -f /boot/loader/loader.conf ]; then + 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) + + if [ "$backup_count" -ne "$conf_count" ]; then + find /boot/loader/entries/ -type f -name "*.conf" | while read imgconf; do + # Backup conf + sudo cp "$imgconf" "$imgconf.bak" + + # 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" + done + else + echo "systemd-boot is already configured..." + fi +fi + # Blacklist nouveau if [[ -z $blacklist_nouveau ]]; then read -n1 -rep "${CAT} Would you like to blacklist nouveau? (y/n)" blacklist_nouveau