#!/bin/sh # by Chris_(medico_2001) # for Klikit-Linux # GPL - June 2007 mycard=`lspci | grep VGA | grep ATI | cut -f 2- -d " "` xterm -e sudo killall synaptic apt-get dpkg adept export XDIALOG_HIGH_DIALOG_COMPAT=1 DIALOG=Xdialog DIA=Xdialog clear $DIALOG --title "Klikit-Linux Wizard" \ --backtitle " Install 3D ATI Radeon (fgrlx) Driver " \ --radiolist "This wizard will install the 3D ATI Radeon (fglrx) Driver. This driver will let you play 3D accelerated games, and increase the performance of certain graphic intensive applications, taking full advantage of the resources of your ATI Radeon video card.\n Before installing this Driver make sure that your card is a 'Radeon' card, and that the model of the card is in the 9xxx series, 9500 or higher, or it is in the X series (e.g. X300), or it has TV-Out capability. The 'fglrx' driver does not support cards earlier than the 9500.\n\n This wizard requires that you are connected to the internet.\n\n Your video card was detected by Klikit-Linux as:\n $mycard \n\n If by any chance this wizard does not work, it creates a backup of your previous xorg.conf file (/etc/X11/xorg.conf.klikit), which can be restored with the command: sudo restore-xorg\n\n Another option to install the ATI driver is using the Envy installer \n If you use Envy to install the driver use that same program to remove it." 55 80 0 \ "Install" "Install ATI Radeon (fglrx) driver" on \ "Remove" "Remove the ATI Radeon (fglrx) driver" off \ "Envy" "Launch the Envy installer" off \ "Exit" "Close this wizard" off 2> /tmp/checklist.tmp.$$ retval=$? if [ $retval = 1 ]; then exit 0 fi choice=`cat /tmp/checklist.tmp.$$` rm -f /tmp/checklist.tmp.$$ # ----------------------------------- if [ "$choice" = "Install" ]; then sudo rm /etc/X11/xorg.conf.klikit sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.klikit xterm -e sudo apt-get install xorg-driver-fglrx fglrx-control echo "enabling driver: Modifying /etc/X11/xorg.conf file"; sleep 1 sudo sed -i -e "s/Driver[ ]\+\"radeon\"/Driver \"fglrx\"\\n Option \"VideoOverlay\" \"on\"\\n Option \"OpenGLOverlay\" \"off\"/g" /etc/X11/xorg.conf sudo sed -i -e "s/Driver[ ]\+\"ati\"/Driver \"fglrx\"\\n Option \"VideoOverlay\" \"on\"\\n Option \"OpenGLOverlay\" \"off\"/g" /etc/X11/xorg.conf sudo sed -i -e "s/Driver[ ]\+\"vesa\"/Driver \"fglrx\"\\n Option \"VideoOverlay\" \"on\"\\n Option \"OpenGLOverlay\" \"off\"/g" /etc/X11/xorg.conf # The ATI driver does not support composite, so it has to be disabled sed -i -e "s/Option \"Composite\" \"Enable\"/Option \"Composite\" \"Disable\"/g" /etc/X11/xorg.conf ers="[[:space:]]\+"; exs="[[:space:]]*"; match() { check=`cat "$1" | grep "$2"`; if [ "$check" == "" ]; then return 1; fi return 0; } imatch() { if match "$1" "$2"; then return 1; fi return 0; } vo replace() { file="$1"; cat "$file" | sed "s/$2/$3/g" > "$file" } if imatch /etc/X11/xorg.conf "^$exs""Option$ers\"Composite\"$ers\"Disable\""; then if imatch /etc/X11/xorg.conf "^$exs""Section$ers\"Extensions\""; then echo 'Section "Extensions" Option "Composite" "Disable" EndSection' >> /etc/X11/xorg.conf; else replace /etc/X11/xorg.conf "^\($exs\)\(Section$ers\"Extensions\".*\)$" "\1\2\n\1 Option \"Composite\" \"Disable\"" fi fi sudo mkdir -p /usr/X11R6/lib/modules/dri sudo ln -s /usr/lib/dri/fglrx_dri.so /usr/X11R6/lib/modules/dri sudo aticonfig --initial sudo aticonfig --overlay-type=Xv kdialog --title="klikit info" --msgbox "Done. it seems the installation of the ATI Radeon (fglrx) driver was sucessful\n to enable it you will have to restart the x-server pressing Ctrl + Alt + Backspace at the same time" fi # ----------------------------------- if [ "$choice" = "Remove" ]; then xterm -e sudo dpkg -P xorg-driver-fglrx fglrx-control kdialog --title="klikit info" --msgbox "the the ATI Radeon (fglrx) driver was successfully removed \n Your previous configuration can be restored with the command: restore-xorg" fi # ----------------------------------- if [ "$choice" = "Envy" ]; then sudo rm /etc/X11/xorg.conf.klikit sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.klikit kdialog --title="klikit info" --msgbox "This option will launch the Envy installer" /usr/bin/envy -g kdialog --title="klikit info" --msgbox "If you installed the driver using Envy, remove it with the same program" fi # ----------------------------------- if [ "$choice" = "Exit" ]; then exit 0 fi exit 0