#!/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.6 2005/02/03 15:22:36 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 get_video_cards() { VIDEO_CARDS=`/sbin/lspci | grep VGA` NUM_CARDS=`echo ${VIDEO_CARDS} | wc -l` if [ ${NUM_CARDS} -eq 1 ] then NVIDIA=`echo ${VIDEO_CARDS} | grep NV` ATI=`echo ${VIDEO_CARDS} | grep "\(R2.*\|R3.*\)"` if [ -z "${NVIDIA}" ] then NVIDIA_CARD=`echo ${NVIDIA} | awk 'BEGIN {RS=" "} /NV[0-9]+/ {print $1}' | cut -dV -f2` if [ ${NVIDIA_CARD} -ge 4 ] then echo "NVIDIA card detected." GLTYPE=nvidia else echo "NVIDIA card is too old for OpenGL." GLTYPE=xorg-x11 fi elif [ -z "${ATI}" ] then echo "ATI card detected." GLTYPE=ati else echo "ATI card is too old for OpenGL." GLTYPE=xorg-x11 fi else echo "No OpenGL-capable card found." GLTYPE=xorg-x11 fi fi } get_video_cards 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