aboutsummaryrefslogtreecommitdiff
path: root/system/nvidia-driver/nvidia-switch
diff options
context:
space:
mode:
Diffstat (limited to 'system/nvidia-driver/nvidia-switch')
-rw-r--r--system/nvidia-driver/nvidia-switch35
1 files changed, 30 insertions, 5 deletions
diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch
index e88534c40a355..6fb27c2bd1001 100644
--- a/system/nvidia-driver/nvidia-switch
+++ b/system/nvidia-driver/nvidia-switch
@@ -19,11 +19,16 @@
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# nvidia-switch utility 0.9.1
+#
+# New maintainer: version 1.x
+# Edward Koenig, Vancouver, United States of America
+# portions Copyright 2007-2011 Heinz Wiesinger (above)
+#
+# nvidia-switch utility 1.0.0
#
# A tool to switch between nvidia-binary-driver and stock xorg-driver
# if both are installed in parallel.
+#
set -e
@@ -36,6 +41,7 @@ XMOD="${LIB}/xorg/modules"
XLIB="$XMOD/extensions"
NV_VERSION='PKGVERSION' # This will be replaced in the build script
GL_VERSION="1.2"
+NV_CONF="/usr/share/X11/xorg.conf.d/10-nvidia.conf"
remove_link(){
if [ -L "$1" ]; then
@@ -222,6 +228,22 @@ nvidia_ldconfig(){
/sbin/ldconfig -l $1
}
+# Make sure system wide 10-nvidia.conf gets swapped out.
+xorg_conf(){
+ if [ "$1" = "nvidia" -a ! -e $NV_CONF ]; then
+ cat <<- EOF > $NV_CONF
+ Section "Device"
+ Identifier "Device0"
+ Driver "nvidia"
+ VendorName "Nvidia Corporation"
+ BoardName ""
+ EndSection
+ EOF
+ else
+ rm -f $NV_CONF
+ fi
+}
+
check(){
echo -n "checking $2...."
if [ -e "$1/$2" ]; then
@@ -357,7 +379,8 @@ nvidia(){
libgl_nvidia
libs "nvidia"
libglx_nvidia
-
+ xorg_conf "nvidia"
+
LD_NVIDIA="${LIB}/libGL.so.$NV_VERSION-nvidia"
nvidia_ldconfig $LD_NVIDIA
}
@@ -367,7 +390,8 @@ xorg(){
if [ "$1" = "cleanup" ]; then
echo $'Cleaning up symlinks.\n'
fi
- echo "Make sure the nvidia driver is DISABLED in /etc/X11/xorg.conf."
+ echo "Make sure the nvidia driver is DISABLED in /etc/X11/xorg.conf"
+ echo "and in /etc/X11/xorg.conf.d."
echo "Otherwise, this may lead to improperly working drivers."
libs_basic
@@ -378,7 +402,8 @@ xorg(){
else
libglx_xorg "xorg"
fi
-
+ xorg_conf "xorg"
+
LD_NVIDIA="${LIB}/libGL.so.1.2"
nvidia_ldconfig $LD_NVIDIA "xorg"
}