1 |
#!/bin/bash |
2 |
# Copyright 1999-2004 Gentoo Technologies, Inc. |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo/src/livecd-tools/x-setup,v 1.4 2004/11/19 16:11:24 wolf31o2 Exp $ |
5 |
|
6 |
#first, get paths right if we're getting started b4 login |
7 |
source /etc/profile |
8 |
|
9 |
echo "0" > /proc/sys/kernel/printk |
10 |
CMDLINE="`cat /proc/cmdline`" |
11 |
for x in $CMDLINE |
12 |
do |
13 |
if [ "$x" = "agpgart" ] |
14 |
then |
15 |
modprobe agpgart > /dev/null 2>&1 |
16 |
fi |
17 |
done |
18 |
|
19 |
GLTYPE=nvidia |
20 |
#now, for the key component :) |
21 |
modprobe nvidia > /dev/null 2>&1 |
22 |
if [ "`lsmod | cut -f1 -d\" \" | grep ^nvidia$`" = "nvidia" ] |
23 |
then |
24 |
echo "NVIDIA driver loaded." |
25 |
else |
26 |
modprobe fglrx > /dev/null 2>&1 |
27 |
if [ "`lsmod | cut -f1 -d\" \" | grep ^fglrx$`" = "fglrx" ] |
28 |
then |
29 |
echo "ATI driver loaded." |
30 |
GLTYPE=ati |
31 |
else |
32 |
#echo "**********************************************************" |
33 |
#echo "NVIDIA or ATI drivers unable to load; aborting." |
34 |
#echo "This demo requires modern NVIDIA or ATI graphics hardware." |
35 |
#echo "**********************************************************" |
36 |
echo "" |
37 |
if [ -e /proc/splash ] |
38 |
then |
39 |
#echo "*******************************" |
40 |
#echo "Entering Vesa browser-only mode" |
41 |
#echo "*******************************" |
42 |
#sleep 3 |
43 |
GLTYPE=xorg-x11 |
44 |
fi |
45 |
fi |
46 |
|
47 |
fi |
48 |
if [ -x /usr/sbin/opengl-update-livecd ] |
49 |
then |
50 |
/usr/sbin/opengl-update-livecd $GLTYPE |
51 |
else |
52 |
opengl-update $GLTYPE |
53 |
fi |
54 |
|
55 |
if [ ! -e /etc/sysconfig/mouse ] |
56 |
then |
57 |
echo "A mouse could not be detected; aborting." |
58 |
echo "Please make sure a mouse is attached to your system." |
59 |
exit 1 |
60 |
fi |
61 |
source /etc/sysconfig/mouse |
62 |
|
63 |
VERTREFRESH="\`ddcxinfo-knoppix -vsync\`" |
64 |
if [ "$VERTREFRESH" = "0-0" ] |
65 |
then |
66 |
echo "No DDC information detected; assuming reasonable defaults." |
67 |
VERTREFRESH=50-80 |
68 |
HORIZSYNC=30-70 |
69 |
else |
70 |
HORIZSYNC="\`ddcxinfo-knoppix -hsync\`" |
71 |
fi |
72 |
|
73 |
sed -i -e "s:##MOUSEPROTO##:${XMOUSETYPE}:" \ |
74 |
-e "s:##MOUSEDEV##:${DEVICE}:" \ |
75 |
-e "s:##VERTREFRESH##:${VERTREFRESH}:" \ |
76 |
-e "s:##HORIZSYNC##:${HORIZSYNC}:" \ |
77 |
-e "s:DefaultColorDepth 16:DefaultColorDepth 24:" \ |
78 |
/etc/X11/XF86Config-4 |
79 |
|
80 |
#exec /usr/X11R6/bin/xinit |