#!/bin/bash # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo/src/livecd-tools/x-setup,v 1.5 2005/02/03 12:25:48 wolf31o2 Exp $ # Check for an xorg.conf if [ ! -e /etc/X11/xorg.conf ] then echo "ERROR: /etc/X11/xorg.conf cannot be found! Exiting" exit 1 fi #first, get paths right if we're getting started b4 login source /etc/profile echo "0" > /proc/sys/kernel/printk CMDLINE="`cat /proc/cmdline`" for x in $CMDLINE do if [ "$x" = "agpgart" ] then modprobe agpgart > /dev/null 2>&1 fi done GLTYPE=nvidia #now, for the key component :) modprobe nvidia > /dev/null 2>&1 if [ "`lsmod | cut -f1 -d\" \" | grep ^nvidia$`" = "nvidia" ] then echo "NVIDIA driver loaded." else modprobe fglrx > /dev/null 2>&1 if [ "`lsmod | cut -f1 -d\" \" | grep ^fglrx$`" = "fglrx" ] then echo "ATI driver loaded." GLTYPE=ati else #echo "**********************************************************" #echo "NVIDIA or ATI drivers unable to load; aborting." #echo "This demo requires modern NVIDIA or ATI graphics hardware." #echo "**********************************************************" echo "" if [ -e /proc/splash ] then #echo "*******************************" #echo "Entering Vesa browser-only mode" #echo "*******************************" #sleep 3 GLTYPE=xorg-x11 fi fi fi if [ -x /usr/sbin/opengl-update-livecd ] then /usr/sbin/opengl-update-livecd $GLTYPE else opengl-update $GLTYPE fi if [ ! -e /etc/sysconfig/mouse ] then echo "A mouse could not be detected; aborting." echo "Please make sure a mouse is attached to your system." exit 1 fi source /etc/sysconfig/mouse VERTREFRESH="\`ddcxinfo-knoppix -vsync\`" if [ "$VERTREFRESH" = "0-0" ] then echo "No DDC information detected; assuming reasonable defaults." VERTREFRESH=50-80 HORIZSYNC=30-70 else HORIZSYNC="\`ddcxinfo-knoppix -hsync\`" fi sed -i -e "s:##MOUSEPROTO##:${XMOUSETYPE}:" \ -e "s:##MOUSEDEV##:${DEVICE}:" \ -e "s:##VERTREFRESH##:${VERTREFRESH}:" \ -e "s:##HORIZSYNC##:${HORIZSYNC}:" \ -e "s:DefaultColorDepth 16:DefaultColorDepth 24:" \ /etc/X11/xorg.conf #exec /usr/X11R6/bin/xinit