#!/usr/bin/perl -w # Erwann Chenede - # compiz sanity check for OpenSolaris use strict; use POSIX qw (uname); my $card_type = "none"; # Platform, Os, Architecture check my ($os,undef, $os_version, $version, $arch) = POSIX::uname(); sub os_check { if (!($os =~ m/SunOS/i)) { print "This script only works on Solaris. exiting (os = $os)\n"; exit(1); } if (!($arch =~ m/i686|i86pc/i)) { print "ERROR : This system is not a i386. Compiz on Solaris only runs on i386\n"; exit(1); } if ($os_version ne "5.11") { print "ERROR : This system doesn't run Solaris 11. Compiz only runs on Solaris 11\n"; exit (1); } $version =~ s/.*_([0-9][0-9]).*/$1/; print "=-=-=-=-=-= Platform checks =-=-=-=-=-=-=\n"; print "os version is : ${os_version} \n"; print "current architecture : ${arch} \n"; print "build number : $version\n"; if ($version < 70) { print "hmmm, this version is a bit old...\nintel drivers will not work prior to build 70\n"; } } # Check for supported video Cards sub card_check { #list of supported intel video card supported # from SUNWdrmr/postinstall my @intel_cards = ( "pci8086,2562", "pci8086,2572", "pci8086,2582", "pci8086,2592", "pci8086,2772", "pci8086,27a2", "pci8086,2972", "pci8086,2982", "pci8086,2992", "pci8086,29a2", "pci8086,2a02", "pci8086,2a12" ); my $PRTCONF = '/usr/sbin/prtconf'; open (OUT, "$PRTCONF -v |") or die ("cannot exec prtconf: $!"); while () { chomp; if ($_ =~ m/nvidia/) { $card_type = "nvidia"; last; } foreach my $card (@intel_cards) { if ($_ =~ /$card/) { $card_type = "i915"; last; } } } close OUT; if ($card_type eq "none") { return 0; } return 1; } # Check for Drivers sub drivers_check { my $MODINFO = '/usr/sbin/modinfo'; open (OUT, "$MODINFO |") or die ("cannot exec modinfo: $!"); while () { chomp; if ($_ =~ m/$card_type/) { return 1; } } close OUT; return 0; } # Check For Xorg Configuration sub nvidia_xorg_conf_check { my $NVIDIAXCONFIG = '/usr/bin/nvidia-xconfig'; if (! -e "/etc/X11/xorg.conf") { print "No /etc/X11/xorg.conf detected\n"; print "Compiz will not run without a proper xorg.conf configuration file.\n\n"; if ($card_type eq "nvidia") { print "This is not a fatal error as the installer will try to generate an\n"; print "appropriate configuration file.\n"; } else { print "Can you generate it by running as root from the console :\n"; print "/usr/X11/bin/Xorg -configure \nthen place and rename "; print "the resulting file in /etc/X11/xorg.conf\n"; exit 0; } } open (OUT, "$NVIDIAXCONFIG -t |") or die ("cannot exec nvidia-xconfig : $!"); my $RenderAccel = "False"; my $AllowGLXWithComposite = "False"; my $AddARGBGLXVisuals = "False"; my $Composite = "Disable"; while () { chomp; if ($_ =~ m/RenderAccel/ && $_ =~ m/True/) { $RenderAccel = "True"; } if ($_ =~ m/AllowGLXWithComposite/ && $_ =~ m/True/) { $AllowGLXWithComposite= "True"; } if ($_ =~ m/AddARGBGLXVisuals/ && $_ =~ m/True/) { $AddARGBGLXVisuals = "True"; } if ($_ =~ m/Composite/ && $_ =~ m/Enable/) { $Composite = "Enable"; } } close OUT; print "Xorg.conf for compiz \n"; print " Render Acceleration : $RenderAccel\n"; print " GLX with Composite : $AllowGLXWithComposite\n"; print " ARGB visuals with GLX: $AddARGBGLXVisuals\n"; print " Composite extension : $Composite\n"; if ($RenderAccel ne "True" || $AllowGLXWithComposite ne "True" || $AddARGBGLXVisuals ne "True" || $Composite ne "Enable") { print "\nXorg.conf is not configured to run compiz.\n"; print "The installer will add these configuration\noptions.\n"; } } sub xorg_version_check { my $XORG = '/usr/X11/bin/Xorg'; open (OUT, "$XORG -version 2>&1 |") or die ("cannot exec $XORG -version 2>&1: $!"); my $xorg_version = "undefined"; while () { chomp $_; if ($_ =~ m/X Window System Version/) { $xorg_version = $_; $xorg_version =~ s/X Window System Version //; } } close OUT; print "X Window System Version : "; if ($xorg_version ne "7.2.0" && $version <= 70) { print "too old you need at least 7.2.0 (you have $xorg_version)\n"; } elsif ($xorg_version ne "1.3.0" && $version > 70) { print "too old you need at least 7.2.0 or the newer 1.3.0 (you have $xorg_version)\n"; } else { print "$xorg_version\n"; } } sub jds_check { open (OUT, "/etc/product-info") or die ("cannot open /etc/product-info: $!"); my $jds_release = 0; my $jds_build_num = 0; my $jds_build_type = 0; while () { chomp $_; if ($_ =~ m/release=/) { $jds_release = $_; $jds_release =~ s/release=//; } if ($_ =~ m/build=/) { $jds_build_num = $_; $jds_build_num =~ s/build=//; } if ($_ =~ m/buildType=/) { $jds_build_type = $_; $jds_build_type =~ s/buildType=//; } } close OUT; print "JDS version : $jds_release b$jds_build_num $jds_build_type\n"; if ($jds_build_type ne "devel" && $jds_build_num < 55) { print "\nJDS development build is not installed on the system.\n"; print "Please install a more recent version of JDS to run Compiz fully.\n"; print "See http://www.opensolaris.org/os/project/jds/ for installation details\n"; } } print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; print "= Compiz on Solaris checklist script =\n"; print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; print "this script run sanity checks to evaluate\n"; print "if compiz is likely to run efficiently on\n"; print "your system\n\n"; os_check (); print "=-=-=-=-=-= Video Card checks =-=-=-=-=-=\n"; print "supported card type : "; if (card_check ()) { print "$card_type\n"; } else { print "none\n"; print "no supported card detected. Compiz not likely to work on this system\n"; exit (1); } if (($card_type eq "i915") && ($version < 70)) { print "\nERROR : intel drivers supporting compiz were integrated in build 70\n"; print "the version of solaris detected ($version) is too old\n"; exit (1); } print "3D drivers loaded : "; if (drivers_check ()) { print "yes\n"; } else { print "no\n"; print "no 3D drivers detected. Compiz not likely to work on this system\n"; if ($card_type eq "nvidia") { print "\nNvidia drivers need to be installed to run Compiz. \nCheck http://www.nvidia.com/object/unix.html\n\n"; } else { print "For intel drivers you need at least OpensSolaris build 70\n"; } } print "=-=-=-=-= Software stack Checks =-=-=-=-=\n"; xorg_version_check (); jds_check (); print "=-=-= X Server configuration checks =-=-=\n"; #also used for intel as nvidia-xconfig is just used as #a parser here. nvidia_xorg_conf_check (); print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; print "Compiz should be able to run on this system\n";