| 1 | #!/bin/bash |
1 | #!/bin/bash |
| 2 | # Copyright 1999-2004 Gentoo Technologies, Inc. |
2 | # Copyright 1999-2004 Gentoo Technologies, Inc. |
| 3 | # Distributed under the terms of the GNU General Public License v2 |
3 | # Distributed under the terms of the GNU General Public License v2 |
| 4 | # $Header: /var/cvsroot/gentoo/src/livecd-tools/x-setup,v 1.7 2005/02/03 20:59:03 wolf31o2 Exp $ |
4 | # $Header: /var/cvsroot/gentoo/src/livecd-tools/x-setup,v 1.8 2005/02/04 13:46:11 wolf31o2 Exp $ |
| 5 | |
5 | |
| 6 | # Check for an xorg.conf |
6 | # Check for an xorg.conf |
| 7 | if [ ! -e /etc/X11/xorg.conf ] |
7 | if [ ! -e /etc/X11/xorg.conf ] |
| 8 | then |
8 | then |
| 9 | echo "ERROR: /etc/X11/xorg.conf cannot be found! Exiting" |
9 | echo "ERROR: /etc/X11/xorg.conf cannot be found! Exiting" |
| … | |
… | |
| 24 | done |
24 | done |
| 25 | |
25 | |
| 26 | get_video_cards() { |
26 | get_video_cards() { |
| 27 | VIDEO_CARDS=`/sbin/lspci | grep VGA` |
27 | VIDEO_CARDS=`/sbin/lspci | grep VGA` |
| 28 | NUM_CARDS=`echo ${VIDEO_CARDS} | wc -l` |
28 | NUM_CARDS=`echo ${VIDEO_CARDS} | wc -l` |
| 29 | if [ ${NUM_CARDS} -eq 1 ] |
29 | if [ ${NUM_CARDS} -eq 1 ]; then |
| 30 | then |
|
|
| 31 | NVIDIA=`echo ${VIDEO_CARDS} | grep NV` |
30 | NVIDIA=`echo ${VIDEO_CARDS} | grep NV` |
| 32 | ATI=`echo ${VIDEO_CARDS} | grep "\(R2.*\|R3.*\)"` |
31 | ATI=`echo ${VIDEO_CARDS} | grep "\(R2.*\|R3.*\)"` |
| 33 | if [ -z "${NVIDIA}" ] |
32 | if [ -n "${NVIDIA}" ]; then |
| 34 | then |
|
|
| 35 | NVIDIA_CARD=`echo ${NVIDIA} | awk 'BEGIN {RS=" "} /NV[0-9]+/ {print $1}' | cut -dV -f2` |
33 | NVIDIA_CARD=`echo ${NVIDIA} | awk 'BEGIN {RS=" "} /NV[0-9]+/ {print $1}' | cut -dV -f2` |
| 36 | if [ ${NVIDIA_CARD} -ge 4 ] |
34 | if [ ${NVIDIA_CARD} -ge 4 ]; then |
| 37 | then |
|
|
| 38 | echo "NVIDIA card detected." |
35 | echo "NVIDIA card detected." |
| 39 | GLTYPE=nvidia |
36 | GLTYPE=nvidia |
| 40 | else |
37 | else |
| 41 | echo "NVIDIA card is too old for OpenGL." |
38 | echo "No OpenGL-capable card found." |
| 42 | GLTYPE=xorg-x11 |
39 | GLTYPE=xorg-x11 |
| 43 | fi |
40 | fi |
| 44 | elif [ -z "${ATI}" ] |
41 | elif [ -n "${ATI}" ]; then |
| 45 | then |
|
|
| 46 | echo "ATI card detected." |
42 | echo "ATI card detected." |
| 47 | GLTYPE=ati |
43 | GLTYPE=ati |
| 48 | else |
|
|
| 49 | echo "ATI card is too old for OpenGL." |
|
|
| 50 | GLTYPE=xorg-x11 |
|
|
| 51 | fi |
|
|
| 52 | else |
44 | else |
| 53 | echo "No OpenGL-capable card found." |
45 | echo "No OpenGL-capable card found." |
| 54 | GLTYPE=xorg-x11 |
46 | GLTYPE=xorg-x11 |
| 55 | fi |
47 | fi |
| 56 | fi |
48 | fi |