#!/bin/sh
export HOME=/root
dialog --backtitle "Vertex Xconfiguration" --title "Xconfigure" \
--msgbox "We are going to attempt to setup your X gui config \
file now. The program will probe your system hardware. This may take \
a little while so don't panic if your screen stays black for a bit. \
Ok if your ready to begin press [enter], if not hit [esc]." 0 0
case $? in
0)
clear
XFree86 -configure 1> /dev/null 2> /dev/null
mv /root/XF86Config.new /etc/X11/XF86Config-4
sleep 2
xf86cfg -textmode
sleep 2
cat /etc/X11/XF86Config-4 | sedins > /etc/X11/XF86Config
mv /etc/X11/XF86Config /etc/X11/XF86Config-4
grep "ChipSet" /etc/X11/XF86Config-4 > /dev/null
if [ $? = 0 ]; then
cat /etc/X11/XF86Config-4 | sed -e '/ChipSet/d' > /etc/X11/XF86Config
mv /etc/X11/XF86Config /etc/X11/XF86Config-4
fi
echo "Section \"DRI\"" >> /etc/X11/XF86Config-4
echo "	Mode 0666" >> /etc/X11/XF86Config-4
echo "EndSection" >> /etc/X11/XF86Config-4
clear
dialog --title "VIDEO BUS TYPE" --yesno "Is your video card AGP style?" 0 0
 
if [ $? = 0 ]; then
grep "agpgart" /etc/rc.d/rc.modules > /dev/null
if [ $? = 1 ]; then
echo " /sbin/modprobe agpgart" >> /etc/rc.d/rc.modules
fi
fi
clear
dialog --title "Configuration completed successfully" --msgbox "You have \
successfully completed your X configuration. If you want to fine tune edit \
the file you will find it in /etc/X11/XF86Config-4. You can start up the X \
system by typing startx at the command prompt" 0 0

;;
1)
echo " cancel pressed exiting"
exit 1
;;
255)
echo "escape pressed exiting"
exit 1
;;
esac

# result=`grep "\"nv\"" /etc/X11/XF86Config-4 > /dev/null`

exit 0