Index: /trunk/src/VBox/Additions/solaris/Installer/postinstall.sh
===================================================================
--- /trunk/src/VBox/Additions/solaris/Installer/postinstall.sh	(revision 50344)
+++ /trunk/src/VBox/Additions/solaris/Installer/postinstall.sh	(revision 50345)
@@ -242,6 +242,24 @@
             fi
 
-            # Adjust xorg.conf with video driver sections
-            $vboxadditions_path/x11config15sol.pl
+            # Check for VirtualBox graphics card
+            is_vboxgraphics=`prtconf -d | grep -i pci80ee,beef`
+            if test "$?" -eq 0; then
+                drivername="vboxvideo"
+            else
+                # Check for VMware graphics card
+                is_vmwaregraphics=`prtconf -d | grep -i pci15ad,405`
+                if test "$?" -eq 0; then
+                    echo "Configuring X.Org to use VMware SVGA graphics driver..."
+                    drivername="vmware"
+                fi
+            fi
+
+            # Adjust xorg.conf with video driver sections if a supported graphics card is found
+            if test ! -z "$drivername"; then
+                $vboxadditions_path/x11config15sol.pl "$drivername"
+            else
+                # No supported graphics card found, do nothing.
+                echo "## No supported graphics card found. Skipped configuring of X.org drivers."
+            fi
         fi
     fi
Index: /trunk/src/VBox/Additions/x11/Installer/x11config15sol.pl
===================================================================
--- /trunk/src/VBox/Additions/x11/Installer/x11config15sol.pl	(revision 50344)
+++ /trunk/src/VBox/Additions/x11/Installer/x11config15sol.pl	(revision 50345)
@@ -1,3 +1,3 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Guest Additions X11 config update script
@@ -14,19 +14,34 @@
 #
 
+use strict;
+use warnings;
+
 my $temp="/tmp/xorg.conf";
 my $os_type=`uname -s`;
-my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
+my @cfg_files = ("/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/X11/xorg.conf-4", "/etc/xorg.conf",
                  "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
                  "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
                  "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
                  "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
+
+## @todo: r=ramshankar: Hmm, why do we use the same variable name with upper/lower case for different variables?
+my $cfg;
 my $CFG;
 my $TMP;
-
+my $line;
 my $config_count = 0;
 
+# Command line options
+if ($#ARGV < 0)
+{
+   die "x11config15sol.pl: Missing driver name argument to configure for X.org";
+}
+my $driver_name = $ARGV[0];
+
+# Loop through all possible config files and change them. It's done this wasy for hysterical raisins
+# as we didn't know what the correct config file is so we update all of them. However, for Solaris it's
+# most likely -only- one of the 2 config files (/etc/X11/xorg.conf, /etc/X11/.xorg.conf).
 foreach $cfg (@cfg_files)
 {
-
     if (open(CFG, $cfg))
     {
@@ -44,5 +59,7 @@
                     $in_section = 1;
                 }
-            } else {
+            }
+			else
+		    {
                 if ($line =~ /^\s*EndSection/i)
                 {
@@ -55,5 +72,5 @@
                 if ($line =~ /^\s*driver\s+\"(?:fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i)
                 {
-                    $line = "    Driver      \"vboxvideo\"\n";
+                    $line = "    Driver      \"$driver_name\"\n";
                 }
             }
@@ -78,2 +95,3 @@
 
 $config_count != 0 or die "Could not find any X11 configuration files";
+
