#!/bin/bash # Usage: xinfo.sh # dianostic tool to collect information # first check for updates if [ $(ping -c1 fractaldimension.org.uk | wc -l) -gt '0' ] ; then nohup wget -O /tmp/xinfo.sh http://fractaldimension.org.uk/ubuntu/xinfo.txt if [ ! "$(cat /tmp/xinfo.sh | md5sum )" = "$(cat /tmp/xinfo.sh | md5sum )" ] ; then echo "Updating script ....." mv /tmp/xinfo.sh ./ chmod a+x ./xinfo.sh ./xinfo.sh exit fi fi # main script echo "Enter your Ubuntuforum name:"; read ubuntuname; name=$(echo $ubuntuname | sed "s/ //g") if ! [ $name ] ; then echo -e "No name given\nexit(1)" ;exit 1 ; fi rm $(echo $name)xinfo.tar.gz installed.txt $(echo $name)X.info summary.txt; touch "$name"X.info ; echo "Username: $ubuntuname" > "$name"X.info; lsb_release -d >> "$name"X.info # version lsb_release -c >> "$name"X.info # version echo "Kernel: $(uname -r)" >> "$name"X.info # kernel cat /proc/cpuinfo | egrep "model name|MHz" >> "$name"X.info lspci -nn >> "$name"X.info # list hardware grep -i "(GPU" /var/log/Xorg.0.log >> "$name"X.info # find the card name from Xorg.0.log grep -i driver /etc/X11/xorg.conf | sed -e '/^\#/d; /kbd/d; /mouse/d; /wacom/d; /synaptics/d' | grep -i driver >> "$name"X.info ps -A | grep -i "xgl" >> "$name"X.info glxinfo | egrep -A2 "direct rendering|OpenGL vendor" >> "$name"X.info xdpyinfo | egrep "version:|dimensions|depth of" >> "$name"X.info if [ $(ps -A | grep "Xgl" | wc -l) -eq '0' ] && [ $(ps -A | grep "compiz" | wc -l) -gt '0' ]; then # turn compiz off for glxgears test echo "switching off compiz"; metacity --replace & sleep 3; script -c " glxgears & sleep 16 ; pkill -15 glxgears" echo "switching compiz back on"; nohup compiz --replace & #1>&2 2> /dev/null else script -c " glxgears & sleep 16 ; pkill -15 glxgears" fi cat typescript | grep FPS >> "$name"X.info rm typescript # lshw -businfo # best run with sudo echo "/etc/default/915resolution" >> "$name"X.info ps -A | grep 915resolution >> "$name"X.info cat /etc/default/915resolution >> "$name"X.info echo "fglrx" >> "$name"X.info echo "For ATI X700:/etc/default/acpi-support SAVE_VBE_STATE=false POST_VIDEO=true USE_DPMS=false For ATI X1300 and the ATI X1400 on a Dell Inspiron 9400, also for ATI X1600 on Asus Z96J (using install method 2)File: /etc/default/acpi-support POST_VIDEO=false" >> "$name"X.info cat /etc/default/acpi-support >> "$name"X.info echo "/etc/default/linux-restricted-modules-common" >> "$name"X.info cat /etc/default/linux-restricted-modules-common | tail >> "$name"X.info echo "http://wiki.cchtml.com/index.php/Troubleshooting (ati)" >> "$name"X.info grep "AlwaysRestartServer" /etc/gdm/gdm.conf >> "$name"X.info grep "TerminateServer" /etc/kde3/kdm/kdmrc >> "$name"X.info echo "sudo mkdir -p /usr/X11R6/lib/modules/dri sudo ln -s /usr/lib/dri/fglrx_dri.so /usr/X11R6/lib/modules/dri" >> "$name"X.info echo "ls -l /usr/X11R6/lib/modules/dri" >> "$name"X.info echo "http://wiki.cchtml.com/index.php/Performance_Issues (ati)" >> "$name"X.info echo "2D Option \"XaaNoOffscreenPixmaps\" 3D Wine Option \"UseFastTLS\" \"2\"" >> "$name"X.info ############## end of main grab ##################### ########## inserted report generator ########## echo 'SRC=$1X.info if [ $2 ] ; then CARD="Graphics Card: \t" CPU="CPU: \t\t" DISTRO="Distribution:\t" KERNEL="Kernel: \t" XVER="X version: \t" DRIVER="Driver: \t" DRI="DRI: \t\t" GLXVER="GLX Server: \t" RES="Resolution: \t" DEPTH="Depth: \t\t" FPS="glxgears FPS: \t" NAME="UserName: \t" XORG="Xorg.conf: \t" COMP="Composite: \t" fi echo -ne "$CARD"; VGA=$(grep -i "vga" $SRC | sed -e "s/^\(.*\)]: // ; s/\[[0-9].*$//"); if [ $(echo "$VGA" | grep -i -c "unknown") -eq "1" ] ; then VGA=$(grep -i "(GPU" $SRC | sed -e "s/^\(.*\): // ; s/ at .*$//"); fi; echo -e "$VGA" | tr "\n" " " | sed "s/ $/\n/" echo -ne "$CPU"; grep "model name" $SRC | head -1 | sed -e "s/^.*: //" echo -ne "$DISTRO"; grep "Description:" $SRC | sed -e "s/^.*:// ; s/\t//" echo -ne "$XVER"; grep "X.Org version" $SRC | sed -e "s/^.*: //" | head -1 echo -ne "$DRIVER"; grep -i "driver" $SRC | sed -e "/^#.*/d ; s/[d|D]river// ; s/ //g; s/\"//g; s/\t//g; /^[O|o]ption.*/d" | tr "\n" " " | sed "s/ $/\n/" echo -ne "$DRI"; grep "direct rendering" $SRC | sed -e "s/direct rendering: //; s/ (.*$//" | head -1 echo -ne "$GLXVER"; grep "glx version" $SRC | sed "s/server glx version string: //" | head -1 echo -ne "$RES"; grep "dimensions:" $SRC | sed -e "s/dimensions://; s/ pixels \(.*\)//; s/ //g" | tr "\n" " " | sed "s/ $/\n/" echo -ne "$DEPTH"; grep "depth of root window" $SRC | sed -e "s/depth of root window://; s/planes//; s/ //g" | tr "\n" " " | sed "s/ $/\n/" echo -ne "$FPS"; grep -i "seconds =" $SRC | sed -e "s/\(.*\)= //; s/ FPS//" | sed "s/\r$//" | echo "(`tr "\n" + ; echo 0`) /$(grep -c "seconds =" $SRC) " | bc username=$(grep -i "username" $SRC | sed "s/Username: //") echo -ne "$KERNEL" ; grep "Kernel:" $SRC | sed "s/Kernel: //" echo -ne "$NAME" ; echo "$1" echo -ne "$XORG"; echo "xorg.conf.$1.txt" if [ $(grep -c Xgl $SRC) -gt 0 ] ; then echo -ne "$COMP"; echo "Xgl" else if [ $(grep "direct rendering" $SRC | grep -c "Yes") -gt '0' ] ; then echo -ne "$COMP"; echo "Aiglx"; else echo -ne "$COMP"; echo "" ; fi fi' > report.sh sed -i '1i#!/bin/bash' report.sh chmod a+x ./report.sh ./report.sh $name > summary.txt ############# copy other files ############ cp /etc/X11/xorg.conf ./xorg.conf.$name.txt # graphics file cp /var/log/Xorg.0.log ./ cat /var/log/Xorg.1.log > Xgl.1.log cp /etc/modprobe.d/blacklist ./ cp /etc/apt/sources.list ./sources.list.txt aptitude search ~imesa ~ixorg ~invidia ~iflgrx ~idbus ~i915resolution ~icompiz ~ixserver-xgl -F "%20p %10v %10V %20d" > installed.txt ls /usr/share/xsessions/xgl*desktop | cat > xgl.txt cat /usr/share/xsessions/xgl*desktop >> xgl.txt if [ `grep start /usr/share/xsessions/xgl*desktop | wc -l` -gt '0' ]; then ls -l $(grep "start" /usr/share/xsessions/xgl*desktop | sed 's/^.*=//') >> xgl.txt cat $(grep "start" /usr/share/xsessions/xgl*desktop | sed 's/^.*=//') >> xgl.txt fi tar -czf "$name"xinfo.tar.gz "$name"X.info summary.txt xorg.conf.$name.txt Xorg.0.log installed.txt blacklist sources.list.txt xgl.txt Xgl.1.log ./report.sh $name -v echo -en "\nCreated $PWD/"; echo -n "$name"; echo "xinfo.tar.gz"