Skip to content

Instantly share code, notes, and snippets.

@ceyusa
Last active June 30, 2019 19:32
Show Gist options
  • Select an option

  • Save ceyusa/a06ce679a9876f2ccad8 to your computer and use it in GitHub Desktop.

Select an option

Save ceyusa/a06ce679a9876f2ccad8 to your computer and use it in GitHub Desktop.
Switching between nouveau and the nVIDIA proprietary OpenGL driver in (Debian) GNU/Linux http://blog.andresgomez.org/2014/11/19/switching-between-nouveau-and-the-nvidia-proprietary-opengl-driver-in-debian-gnulinux/
#!/bin/bash
ALTERNATIVE=""
function check_root {
ID=`id -u`
if [ ${ID} -ne 0 ]; then
echo "You have to be root to run this script"
exit 0
fi
}
function syntax {
echo "Syntax: $0 [nvidia|nouveau]"
exit 0
}
check_root
if [ -z "${1}" ]; then
syntax
elif [ "x${1}" == "xnouveau" ]; then
ALTERNATIVE="/usr/lib/mesa-diverted"
elif [ "x${1}" == "xnvidia" ]; then
ALTERNATIVE="/usr/lib/nvidia"
else
syntax
fi
update-alternatives --set glx "${ALTERNATIVE}"
update-initramfs -u
echo ""
echo "${1} successfully set. Reboot your system to apply the changes ..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment