/[gentoo-x86]/eclass/nvidia-driver.eclass
Gentoo

Contents of /eclass/nvidia-driver.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download)
Tue Jul 17 11:59:18 2007 UTC (7 years, 1 month ago) by swegener
Branch: MAIN
Changes since 1.7: +2 -2 lines
Apply whitespace checks from repoman to eclasses.

1 cardoe 1.1 # Copyright 1999-2007 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 swegener 1.8 # $Header: /var/cvsroot/gentoo-x86/eclass/nvidia-driver.eclass,v 1.7 2007/07/16 15:38:30 cardoe Exp $
4 cardoe 1.1
5     #
6     # Original Author: Doug Goldstein <cardoe@gentoo.org>
7     # Purpose: Provide useful messages for nvidia-drivers based on currently
8     # installed Nvidia card
9     #
10 cardoe 1.4 inherit versionator
11 cardoe 1.1
12     DEPEND="sys-apps/pciutils"
13    
14 cardoe 1.2 # the data below is derived from
15     # http://us.download.nvidia.com/XFree86/Linux-x86_64/100.14.11/README/appendix-a.html
16    
17 cardoe 1.1 drv_96xx="0110 0111 0112 0113 0170 0171 0172 0173 0174 0175 0176 0177 0178 \
18     0179 017a 017c 017d 0181 0182 0183 0185 0188 018a 018b 018c 01a0 01f0 0200 \
19     0201 0202 0203 0250 0251 0253 0258 0259 025b 0280 0281 0282 0286 0288 0289 \
20     028c"
21    
22     drv_71xx="0020 0028 0029 002c 002d 00a0 0100 0101 0103 0150 0151 0152 0153"
23    
24     mask_96xx=">=x11-drivers/nvidia-drivers-1.0.9700"
25     mask_71xx=">=x11-drivers/nvidia-drivers-1.0.7200"
26    
27 cardoe 1.4 pv_96xx="1.0.9700"
28     pv_71xx="1.0.7200"
29    
30 cardoe 1.1 # Retrieve the PCI device ID for each Nvidia video card you have
31     nvidia-driver-get-card() {
32     local NVIDIA_CARD="$(/usr/sbin/lspci -d 10de: -n | \
33     awk '/ 0300: /{print $3}' | cut -d: -f2 | tr '\n' ' ')"
34    
35     if [ -n "$NVIDIA_CARD" ]; then
36     echo "$NVIDIA_CARD";
37     else
38     echo "0000";
39     fi
40     }
41    
42     nvidia-driver-get-mask() {
43     local NVIDIA_CARDS="$(nvidia-driver-get-card)"
44     for card in $NVIDIA_CARDS; do
45     for drv in $drv_96xx; do
46     if [ "x$card" = "x$drv" ]; then
47     echo "$mask_96xx";
48     return 0;
49     fi
50     done
51    
52     for drv in $drv_71xx; do
53     if [ "x$card" = "x$drv" ]; then
54     echo "$mask_71xx";
55     return 0;
56     fi
57     done
58    
59     done
60    
61     echo "";
62     return 1;
63     }
64    
65     nvidia-driver-check-warning() {
66     local NVIDIA_MASK="$(nvidia-driver-get-mask)"
67     if [ -n "$NVIDIA_MASK" ]; then
68 cardoe 1.7 version_compare "${NVIDIA_MASK##*-}" "${PV}"
69 cardoe 1.4 r=$?
70    
71 cardoe 1.7 if [ "x$r" = "x1" ]; then
72 cardoe 1.4 ewarn "***** WARNING *****"
73 swegener 1.8 ewarn
74 cardoe 1.4 ewarn "You are currently installing a version of nvidia-drivers that is"
75     ewarn "known not to work with a video card you have installed on your"
76     ewarn "system. If this is intentional, please ignore this. If it is not"
77     ewarn "please perform the following steps:"
78     ewarn
79     ewarn "Add the following mask entry to /etc/portage/package.mask by"
80     if [ -d "${ROOT}/etc/portage/package.mask" ]; then
81     ewarn "echo \"$NVIDIA_MASK\" > /etc/portage/package.mask/nvidia-drivers"
82     else
83     ewarn "echo \"$NVIDIA_MASK\" >> /etc/portage/package.mask"
84     fi
85     ewarn
86     ewarn "Failure to perform the steps above could result in a non-working"
87     ewarn "X setup."
88     ewarn
89     ewarn "For more information please read:"
90     ewarn "http://www.nvidia.com/object/IO_32667.html"
91     ebeep 5
92 cardoe 1.1 fi
93     fi
94     }

  ViewVC Help
Powered by ViewVC 1.1.20