| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/nvidia-driver.eclass,v 1.3 2007/07/16 13:39:36 cardoe Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/nvidia-driver.eclass,v 1.9 2007/10/01 18:54:39 cardoe Exp $ |
| 4 | |
4 | |
| 5 | # |
5 | # |
| 6 | # Original Author: Doug Goldstein <cardoe@gentoo.org> |
6 | # Original Author: Doug Goldstein <cardoe@gentoo.org> |
| 7 | # Purpose: Provide useful messages for nvidia-drivers based on currently |
7 | # Purpose: Provide useful messages for nvidia-drivers based on currently |
| 8 | # installed Nvidia card |
8 | # installed Nvidia card |
| 9 | # |
9 | # |
|
|
10 | inherit versionator |
| 10 | |
11 | |
| 11 | DEPEND="sys-apps/pciutils" |
12 | DEPEND="sys-apps/pciutils" |
| 12 | |
13 | |
| 13 | # the data below is derived from |
14 | # the data below is derived from |
| 14 | # http://us.download.nvidia.com/XFree86/Linux-x86_64/100.14.11/README/appendix-a.html |
15 | # http://us.download.nvidia.com/XFree86/Linux-x86_64/100.14.11/README/appendix-a.html |
| … | |
… | |
| 18 | 0201 0202 0203 0250 0251 0253 0258 0259 025b 0280 0281 0282 0286 0288 0289 \ |
19 | 0201 0202 0203 0250 0251 0253 0258 0259 025b 0280 0281 0282 0286 0288 0289 \ |
| 19 | 028c" |
20 | 028c" |
| 20 | |
21 | |
| 21 | drv_71xx="0020 0028 0029 002c 002d 00a0 0100 0101 0103 0150 0151 0152 0153" |
22 | drv_71xx="0020 0028 0029 002c 002d 00a0 0100 0101 0103 0150 0151 0152 0153" |
| 22 | |
23 | |
| 23 | mask_96xx=">=x11-drivers/nvidia-drivers-1.0.9700" |
24 | mask_96xx=">=x11-drivers/nvidia-drivers-97.0.0" |
| 24 | mask_71xx=">=x11-drivers/nvidia-drivers-1.0.7200" |
25 | mask_71xx=">=x11-drivers/nvidia-drivers-72.0.0\n=x11-drivers/nvidia-1.0.9639" |
| 25 | |
26 | |
| 26 | # Retrieve the PCI device ID for each Nvidia video card you have |
27 | # Retrieve the PCI device ID for each Nvidia video card you have |
| 27 | nvidia-driver-get-card() { |
28 | nvidia-driver-get-card() { |
| 28 | local NVIDIA_CARD="$(/usr/sbin/lspci -d 10de: -n | \ |
29 | local NVIDIA_CARD="$(/usr/sbin/lspci -d 10de: -n | \ |
| 29 | awk '/ 0300: /{print $3}' | cut -d: -f2 | tr '\n' ' ')" |
30 | awk '/ 0300: /{print $3}' | cut -d: -f2 | tr '\n' ' ')" |
| … | |
… | |
| 59 | } |
60 | } |
| 60 | |
61 | |
| 61 | nvidia-driver-check-warning() { |
62 | nvidia-driver-check-warning() { |
| 62 | local NVIDIA_MASK="$(nvidia-driver-get-mask)" |
63 | local NVIDIA_MASK="$(nvidia-driver-get-mask)" |
| 63 | if [ -n "$NVIDIA_MASK" ]; then |
64 | if [ -n "$NVIDIA_MASK" ]; then |
|
|
65 | version_compare "${NVIDIA_MASK##*-}" "${PV}" |
|
|
66 | r=$? |
|
|
67 | |
|
|
68 | if [ "x$r" = "x1" ]; then |
| 64 | ewarn "***** WARNING *****" |
69 | ewarn "***** WARNING *****" |
| 65 | ewarn |
70 | ewarn |
| 66 | ewarn "You are currently installing a version of nvidia-drivers that is" |
71 | ewarn "You are currently installing a version of nvidia-drivers that is" |
| 67 | ewarn "known not to work with a video card you have installed on your" |
72 | ewarn "known not to work with a video card you have installed on your" |
| 68 | ewarn "system. If this is intentional, please ignore this. If it is not" |
73 | ewarn "system. If this is intentional, please ignore this. If it is not" |
| 69 | ewarn "please perform the following steps:" |
74 | ewarn "please perform the following steps:" |
| 70 | ewarn |
75 | ewarn |
| 71 | ewarn "Add the following mask entry to /etc/portage/package.mask by" |
76 | ewarn "Add the following mask entry to /etc/portage/package.mask by" |
| 72 | if [ -d "${ROOT}/etc/portage/package.mask" ]; then |
77 | if [ -d "${ROOT}/etc/portage/package.mask" ]; then |
| 73 | ewarn "echo \"$NVIDIA_MASK\" > /etc/portage/package.mask/nvidia-drivers" |
78 | ewarn "echo \"$NVIDIA_MASK\" > /etc/portage/package.mask/nvidia-drivers" |
| 74 | else |
79 | else |
| 75 | ewarn "echo \"$NVIDIA_MASK\" >> /etc/portage/package.mask" |
80 | ewarn "echo \"$NVIDIA_MASK\" >> /etc/portage/package.mask" |
|
|
81 | fi |
|
|
82 | ewarn |
|
|
83 | ewarn "Failure to perform the steps above could result in a non-working" |
|
|
84 | ewarn "X setup." |
|
|
85 | ewarn |
|
|
86 | ewarn "For more information please read:" |
|
|
87 | ewarn "http://www.nvidia.com/object/IO_32667.html" |
|
|
88 | ebeep 5 |
| 76 | fi |
89 | fi |
| 77 | ewarn |
|
|
| 78 | ewarn "Failure to perform the steps above could result in a non-working" |
|
|
| 79 | ewarn "X setup." |
|
|
| 80 | ewarn |
|
|
| 81 | ewarn "For more information please read:" |
|
|
| 82 | ewarn "http://www.nvidia.com/object/IO_32667.html" |
|
|
| 83 | ebeep 5 |
|
|
| 84 | fi |
90 | fi |
| 85 | } |
91 | } |
| 86 | |
92 | |
| 87 | |
93 | |