postplug/scripts/nvidia-autoselect-driver
2011-04-27 19:57:03 +02:00

50 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
#
# nVidia legacy test script
#
# Copyright (c) 2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Released under the GNU GPL v.3 license
#
PCIID=`/usr/sbin/lspci -n | grep " 0300: 10de:" | awk '{ print $3 }'`
[ "$PCIID" ] || exit 0
DEVID=${PCIID/*:/}
case $DEVID in
0020|0028|0029|002c|002d|\
00a0|0100|0101|0103|0150|\
0151|0152|0153) ALT_SUFFIX='_71xx' ;;
0110|0111|0112|0113|0170|\
0171|0172|0173|0174|0175|\
0176|0177|0178|0179|017a|\
017c|017d|0181|0182|0183|\
0185|0188|018a|018b|018c|\
01a0|01f0|0200|0201|0202|\
0203|0250|0251|0253|0258|\
0259|025b|0280|0281|0282|\
0286|0288|0289|028c) ALT_SUFFIX='_96xx' ;;
00FA|00FB|00FC|00FD|00FE|\
0301|0302|0308|0309|0311|\
0312|0314|031A|031B|031C|\
0320|0321|0322|0323|0324|\
0325|0326|0327|0328|032A|\
032B|032C|032D|0330|0331|\
0332|0333|0334|0338|033F|\
0341|0342|0343|0344|0347|\
0348|034C|034E) ALT_SUFFIX='_173xx' ;;
*) ALT_SUFFIX='' ;;
esac
if [ -x /usr/sbin/update-alternatives-set-nvidia$ALT_SUFFIX ]; then
/usr/sbin/update-alternatives-set-nvidia$ALT_SUFFIX
elif [ -x /usr/sbin/update-alternatives-set-dri ]; then
/usr/sbin/update-alternatives-set-dri
else
exit 1
fi
exit 0