#!/bin/bash RED='\033[0;31m' RESET='\033[0m' KERNEL="$(uname -r)" function rootCheck(){ if [ "$USER" != "root" ]; then echo "$RED You need to be root to run this script... $RESET" exit 1 fi } function xorgInstall(){ pacman -S xorg xorg-server if [ "$?" != "0" ]; then echo "$RED An error occurred while installing Xorg $RESET" exit 1 fi } function nvidiaInstall(){ pacman -S nvidia nvidia-utils nvidia-settings opencl-nvidia if [ "$?" != "0" ]; then echo "$RED An error occurred while installing the NVIDIA drivers on kernel $KERNEL $RESET" exit 1 fi cat /usr/lib/modprobe.d/nvidia-lts.conf } function nvidiaInstallLTS(){ pacman -S nvidia-lts nvidia-utils nvidia-settings opencl-nvidia if [ "$?" != "0" ]; then echo "$RED An error occurred while installing the NVIDIA LTS drivers on kernel $KERNEL LTS $RESET" exit 1 fi cat /usr/lib/modprobe.d/nvidia-lts.conf } rootCheck xorgInstall case $1 in --lts) nvidiaInstallLTS ;; *) nvidiaInstall ;; esac exit 0