This patch adds the ability for VirtualBox packaged installer script
to configure USB filters on OpenSolaris and non-Oracle descendant
distributions. For those distros not immediately covered by the patch,
there is an ability to force the logic by 'touch /etc/vboxinst_vboxusb'

Copyright (C) 2013-2015 by Jim Klimov under the terms of MIT License.

--- vboxconfig.sh.orig	2015-03-02 16:17:43.000000000 +0100
+++ vboxconfig.sh	2015-03-09 15:30:35.673996000 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 # $Id: vboxconfig.sh 91874 2014-01-28 12:29:16Z ramshankar $
 ## @file
-# VirtualBox Configuration Script, Solaris host.
+# VirtualBox Configuration Script, Solaris (10, 11, 12, SXCE, illumos) host.
 #
 
 #
@@ -280,6 +280,16 @@
                         HOST_OS_MINORVERSION=`echo "$STR_KERN_MINOR" | cut -f2 -d'-' | cut -f6 -d'.'`
                     elif test "$HOST_OS_MAJORVERSION" -eq 11; then
                         HOST_OS_MINORVERSION=`echo "$STR_KERN_MINOR" | cut -f2 -d'-' | cut -f2 -d'.'`
+                        case "`uname -v`" in
+                            Generic_*) ;; # Sun/Oracle Solaris GA release
+                            snv_*) # OpenSolaris
+                                HOST_OS_MINORVERSION="`uname -v | sed 's/^snv_//'`" || \
+                                HOST_OS_MINORVERSION=0 ;;
+                            oi*|omnios*|illumos*) # More distros welcome
+                                infoprint "Detected an opensource Solaris descendant, assuming snv_151 compatibility"
+                                HOST_OS_MINORVERSION=151
+                                ;;
+                        esac
                     else
                         errorprint "Solaris kernel major version $HOST_OS_MAJORVERSION not supported."
                         exit 1
@@ -299,16 +309,32 @@
     else
         HOST_OS_MAJORVERSION=`uname -r`
         if test -z "$HOST_OS_MAJORVERSION" || test "$HOST_OS_MAJORVERSION" != "5.10";  then
-            # S11 without 'pkg'?? Something's wrong... bail.
-            errorprint "Solaris $HOST_OS_MAJORVERSION detected without executable $BIN_PKG !? I are confused."
-            exit 1
+            case "`uname -v`" in
+                snv*) if grep "Solaris Express Community Edition snv_" $PKG_INSTALL_ROOT/etc/release 2>/dev/null; then
+                        infoprint "WARNING: Solaris SXCE detected... you really should upgrade!"
+                        infoprint "         Assuming that Solaris 10 methods are applicable."
+                        HOST_OS_MAJORVERSION=SXCE
+                      fi ;;
+            esac
+            if test "$HOST_OS_MAJORVERSION" != "SXCE"; then
+                # S11 without 'pkg'?? Something's wrong... bail.
+                errorprint "Solaris $HOST_OS_MAJORVERSION detected without executable $BIN_PKG !? I am confused."
+                exit 1
+            fi
+            HOST_OS_MAJORVERSION="11"
+            HOST_OS_MINORVERSION="`uname -v | sed 's/^snv_//'`" || \
+                HOST_OS_MINORVERSION=0
+        else
+            HOST_OS_MAJORVERSION="10"
         fi
-        HOST_OS_MAJORVERSION="10"
+
         if test "$REMOTEINST" -eq 0; then
-            # Use uname to verify it's S10.
-            # Major version is S10, Minor version is no longer relevant (or used), use uname -v so it gets something
-            # like "Generic_blah" for purely cosmetic purposes
-            HOST_OS_MINORVERSION=`uname -v`
+            if test "$HOST_OS_MAJORVERSION" != 11 ; then
+                # Use uname to verify it's S10.
+                # Major version is S10, Minor version is no longer relevant (or used), use uname -v so it gets something
+                # like "Generic_blah" for purely cosmetic purposes
+                HOST_OS_MINORVERSION=`uname -v`
+            fi
         else
             # Remote installs from S10 local.
             BIN_PKGCHK=`which pkgchk 2> /dev/null`
@@ -320,10 +346,12 @@
 
             REMOTE_S10=`$BIN_PKGCHK -l -p /kernel/amd64/genunix $BASEDIR_PKGOPT 2> /dev/null | grep SUNWckr | tr -d ' \t'`
             if test ! -z "$REMOTE_S10" && test "$REMOTE_S10" = "SUNWckr"; then
-                HOST_OS_MAJORVERSION="10"
-                HOST_OS_MINORVERSION=""
+                if test "$HOST_OS_MAJORVERSION" != 11 ; then
+                    HOST_OS_MAJORVERSION="10"
+                    HOST_OS_MINORVERSION=""
+                fi
             else
-                errorprint "Remote target $PKG_INSTALL_ROOT is not Solaris 10."
+                errorprint "Remote target $PKG_INSTALL_ROOT is not Solaris 10 nor SXCE."
                 errorprint "Will not attempt to install to an unidentified remote target."
                 exit 1
             fi
@@ -669,9 +697,23 @@
     fi
 
     # Load VBoxUSBMon, VBoxUSB
-    if test -f "$DIR_CONF/vboxusbmon.conf" && test "$HOST_OS_MAJORVERSION" != "10"; then
-        # For VirtualBox 3.1 the new USB code requires Nevada > 123 i.e. S12+ or S11 b124+
-        if test "$HOST_OS_MAJORVERSION" -gt 11 || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -gt 123); then
+    try_vboxusb=no
+    if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxusb"; then
+        subprint "Detected: Force-load file $PKG_INSTALL_ROOT/etc/vboxinst_vboxusb."
+        try_vboxusb=yes
+    else
+        if test -f "$DIR_CONF/vboxusbmon.conf" && test "$HOST_OS_MAJORVERSION" != "10"; then
+            # For VirtualBox 3.1 the new USB code requires Nevada > 123 i.e. S12+ or S11 b124+
+            if test "$HOST_OS_MAJORVERSION" -gt 11 || \
+              (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -gt 123); then
+                try_vboxusb=yes
+            else
+                warnprint "Solaris 11 build 124 or higher required for USB support. Skipped installing USB support."
+            fi
+        fi
+    fi
+
+    if test "$try_vboxusb" = yes ; then
             # Add a group "vboxuser" (8-character limit) for USB access.
             # All users which need host USB-passthrough support will have to be added to this group.
             groupadd vboxuser >/dev/null 2>&1
@@ -703,9 +745,6 @@
                 add_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP" "$NULLOP"
                 load_module "drv/$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP"
             fi
-        else
-            warnprint "Solaris 11 build 124 or higher required for USB support. Skipped installing USB support."
-        fi
     fi
 
     return $?
