Fixes for GPU script

This commit is contained in:
Phillip 2024-09-07 23:42:59 +01:00
parent 150641e21c
commit 8a5a860a54

View File

@ -42,6 +42,18 @@ case $yesno in
;; ;;
* ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";; * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
esac esac
# Ask if this is being installed as a VM or bare metal, then install appropriate video drivers
read -p 'Is this being installed on VMWare Fusion? ' vmyesno
case $vmyesno in
[yesYesYy]* )
gpudriver = "vmware"
;;
[noNoNn]* )
gpudriver = "nvidia"
;;
* ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
esac
export gpu = $gpudriver
# Get user credentials # Get user credentials
read -p "Please enter a username " username read -p "Please enter a username " username
read -rsp "Please enter a password " password read -rsp "Please enter a password " password
@ -103,28 +115,24 @@ echo "$username:$password" | chpasswd
passwd --lock root passwd --lock root
# Set up sudo so "wheel" group users can do root commands (password required) # Set up sudo so "wheel" group users can do root commands (password required)
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
# Ask if this is being installed as a VM or bare metal, then install appropriate video drivers # Set up GPU drivers depending on device
read -p 'Is this being installed on VMWare Fusion? ' vmyesno if [[ $gpu == "vmware" ]]
case $vmyesno in echo "Installing VM drivers"
[yesYesYy]* ) pacman -S --noconfirm --needed open-vm-tools
echo "Installing VM drivers" cat /proc/version > /etc/arch-release
pacman -S --noconfirm --needed open-vm-tools systemctl enable vmware-vmblock-fuse
cat /proc/version > /etc/arch-release systemctl enable vmtoolsd
systemctl enable vmware-vmblock-fuse pacman -S --noconfirm --needed xf86-input-vmmouse xf86-video-vmware mesa
systemctl enable vmtoolsd fi
pacman -S --noconfirm --needed xf86-input-vmmouse xf86-video-vmware mesa if [[ $gpu == "nvidia" ]]
;; echo "Installing NVIDIA GPU drivers"
[noNoNn]* ) pacman -S --noconfirm nvidia-dkms nvidia-utils lib32-nvidia-utils nvidia-settings
echo "Installing NVIDIA GPU drivers" # Tweak systemd.conf and enable services for proper suspend/resume
pacman -S --noconfirm nvidia-dkms nvidia-utils lib32-nvidia-utils nvidia-settings echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1" >> /lib/modprobe.d/systemd.conf
# Tweak systemd.conf and enable services for proper suspend/resume systemctl enable nvidia-suspend.service
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1" >> /lib/modprobe.d/systemd.conf systemctl enable nvidia-hibernate.service
systemctl enable nvidia-suspend.service systemctl enable nvidia-resume.service
systemctl enable nvidia-hibernate.service fi
systemctl enable nvidia-resume.service
;;
* ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
esac
# Required to enable network changes (not sure if this is neccesary) # Required to enable network changes (not sure if this is neccesary)
#sysctl --system #sysctl --system
# Prompt the user to reboot # Prompt the user to reboot