Index: /trunk/src/VBox/Installer/linux/install.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/install.sh	(revision 35203)
+++ /trunk/src/VBox/Installer/linux/install.sh	(revision 35204)
@@ -354,5 +354,4 @@
         test -e $INSTALLATION_DIR/VBoxHeadless  && chmod 4511 $INSTALLATION_DIR/VBoxHeadless
         test -e $INSTALLATION_DIR/VBoxNetDHCP   && chmod 4511 $INSTALLATION_DIR/VBoxNetDHCP
-        test -e $INSTALLATION_DIR/VBoxExtPackHelperApp && chmod 4511 $INSTALLATION_DIR/VBoxExtPackHelperApp
 
         ln -sf $INSTALLATION_DIR/VBoxVMM.so   $INSTALLATION_DIR/components/VBoxVMM.so
Index: /trunk/src/VBox/Installer/solaris/makepackage.sh
===================================================================
--- /trunk/src/VBox/Installer/solaris/makepackage.sh	(revision 35203)
+++ /trunk/src/VBox/Installer/solaris/makepackage.sh	(revision 35204)
@@ -208,6 +208,4 @@
         ||  $3 == "opt/VirtualBox/amd64/VBoxNetDHCP" \
         ||  $3 == "opt/VirtualBox/i386/VBoxNetDHCP" \
-        ||  $3 == "opt/VirtualBox/amd64/VBoxExtPackHelperApp" \
-        ||  $3 == "opt/VirtualBox/i386/VBoxExtPackHelperApp" \
         ) \
    { $4 = "4755" } { print }' prototype > prototype2
Index: /trunk/src/VBox/Main/VBoxExtPackHelperApp.cpp
===================================================================
--- /trunk/src/VBox/Main/VBoxExtPackHelperApp.cpp	(revision 35203)
+++ /trunk/src/VBox/Main/VBoxExtPackHelperApp.cpp	(revision 35204)
@@ -24,4 +24,5 @@
 #include <iprt/buildconfig.h>
 #include <iprt/dir.h>
+#include <iprt/env.h>
 #include <iprt/file.h>
 #include <iprt/fs.h>
@@ -44,9 +45,4 @@
 #include <VBox/version.h>
 
-#if defined(RT_OS_DARWIN)
-# include <sys/types.h>
-# include <unistd.h>                    /* geteuid */
-#endif
-
 #ifdef RT_OS_WINDOWS
 # define _WIN32_WINNT 0x0501
@@ -64,7 +60,11 @@
 #endif
 
-#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
+#if !defined(RT_OS_OS2)
 # include <stdio.h>
 # include <errno.h>
+# if !defined(RT_OS_WINDOWS)
+#  include <sys/types.h>
+#  include <unistd.h>                   /* geteuid */
+# endif
 #endif
 
@@ -74,8 +74,20 @@
 *******************************************************************************/
 /** Enable elevation on Windows and Darwin. */
-#if defined(RT_OS_WINDOWS) || defined(RT_OS_DARWIN) || defined(DOXYGEN_RUNNING)
+#if !defined(RT_OS_OS2) || defined(DOXYGEN_RUNNING)
 # define WITH_ELEVATION
 #endif
 
+
+/** @name Command and option names
+ * @{ */
+#define CMD_INSTALL         1000
+#define CMD_UNINSTALL       1001
+#define CMD_CLEANUP         1002
+#ifdef WITH_ELEVATION
+# define OPT_ELEVATED       1090
+# define OPT_STDOUT         1091
+# define OPT_STDERR         1092
+#endif
+/** @}  */
 
 
@@ -1048,4 +1060,52 @@
 #ifdef WITH_ELEVATION
 
+#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_DARWIN)
+/**
+ * Looks in standard locations for a suitable exec tool.
+ *
+ * @returns true if found, false if not.
+ * @param   pszPath             Where to store the path to the tool on
+ *                              successs.
+ * @param   cbPath              The size of the buffer @a pszPath points to.
+ * @param   pszName             The name of the tool we're looking for.
+ */
+static bool FindExecTool(char *pszPath, size_t cbPath, const char *pszName)
+{
+    static const char * const s_apszPaths[] =
+    {
+        "/bin",
+        "/usr/bin",
+        "/usr/local/bin",
+        "/sbin",
+        "/usr/sbin",
+        "/usr/local/sbin",
+#ifdef RT_OS_SOLARIS
+        "/usr/sfw/bin",
+        "/usr/gnu/bin",
+        "/usr/xpg4/bin",
+        "/usr/xpg6/bin",
+        "/usr/ucb"
+#endif
+    };
+
+    for (unsigned i = 0; i < RT_ELEMENTS(s_apszPaths); i++)
+    {
+        int rc = RTPathJoin(pszPath, cbPath, s_apszPaths[i], pszName);
+        if (RT_SUCCESS(rc))
+        {
+            RTFSOBJINFO ObjInfo;
+            rc = RTPathQueryInfoEx(pszPath, &ObjInfo, RTFSOBJATTRADD_UNIX, RTPATH_F_FOLLOW_LINK);
+            if (RT_SUCCESS(rc))
+            {
+                if (!(ObjInfo.Attr.fMode & RTFS_UNIX_IWOTH))
+                    return true;
+            }
+        }
+    }
+    return false;
+}
+#endif
+
+
 /**
  * Copies the content of a file to a stream.
@@ -1091,11 +1151,17 @@
  * @returns Program exit code.
  * @param   pszExecPath         The executable path.
- * @param   cArgs               The number of arguments.
  * @param   papszArgs           The arguments.
- */
-static RTEXITCODE RelaunchElevatedNative(const char *pszExecPath, int cArgs, const char * const *papszArgs)
+ * @param   cSuArgs             The number of argument entries reserved for the
+ *                              'su' like programs at the start of papszArgs.
+ * @param   cMyArgs             The number of arguments following @a cSuArgs.
+ * @param   iCmd                The command that is being executed. (For
+ *                              selecting messages.)
+ */
+static RTEXITCODE RelaunchElevatedNative(const char *pszExecPath, const char **papszArgs, int cSuArgs, int cMyArgs,
+                                         int iCmd)
 {
     RTEXITCODE rcExit = RTEXITCODE_FAILURE;
 #ifdef RT_OS_WINDOWS
+    NOREF(iCmd);
 
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
@@ -1111,5 +1177,5 @@
     {
         char *pszCmdLine;
-        rc = RTGetOptArgvToString(&pszCmdLine, &papszArgs[1], RTGETOPTARGV_CNV_QUOTE_MS_CRT);
+        rc = RTGetOptArgvToString(&pszCmdLine, &papszArgs[cSuArgs + 1], RTGETOPTARGV_CNV_QUOTE_MS_CRT);
         if (RT_SUCCESS(rc))
         {
@@ -1198,4 +1264,5 @@
         AuthorizationRights AuthRights      = { 1, &AuthItem };
 
+        NOREF(iCmd);
         static char         s_szPrompt[]    = "VirtualBox needs further rights to make changes to your installation.\n\n";
         AuthorizationItem   aAuthEnvItems[] =
@@ -1217,5 +1284,5 @@
             FILE *pSocketStrm;
             orc = AuthorizationExecuteWithPrivileges(AuthRef, pszExecPath, kAuthorizationFlagDefaults,
-                                                     (char * const *)&papszArgs[3],
+                                                     (char * const *)&papszArgs[cSuArgs + 3],
                                                      &pSocketStrm);
             if (orc == errAuthorizationSuccess)
@@ -1248,5 +1315,124 @@
 
 #else
-# error "PORT ME"
+    /*
+     * Look for various standard stuff for executing a program as root.
+     *
+     * N.B. When adding new arguments, please make 100% sure RelaunchElevated
+     *      allocates enough array entries.
+     *
+     * TODO: Feel free to contribute code for using PolicyKit directly.
+     */
+    bool        fHaveDisplayVar = RTEnvExist("DISPLAY");
+    int         iSuArg          = cSuArgs;
+    char       *pszCmdLine      = NULL;
+    PRTHANDLE   pStdNull        = NULL;
+    RTHANDLE    StdNull;
+    char        szExecTool[260];
+    char        szXterm[260];
+    int         rc;
+
+    /*
+     * gksu is our favorite as it is very well integrated.
+     *
+     * gksu is chatty, so we need to send stderr and stdout to /dev/null or the
+     * error detection logic in Main will fail.  This is a bit unfortunate as
+     * error messages gets lost, but wtf.
+     */
+    if (fHaveDisplayVar && FindExecTool(szExecTool, sizeof(szExecTool), "gksu"))
+    {
+        rc = RTFileOpenBitBucket(&StdNull.u.hFile, RTFILE_O_WRITE);
+        if (RT_SUCCESS(rc))
+        {
+            StdNull.enmType = RTHANDLETYPE_FILE;
+            pStdNull = &StdNull;
+
+            iSuArg = cSuArgs - 4;
+            papszArgs[cSuArgs - 4] = szExecTool;
+            papszArgs[cSuArgs - 3] = "--description";
+            papszArgs[cSuArgs - 2] = iCmd == CMD_INSTALL
+                                   ? "VirtualBox extension pack installer"
+                                   : iCmd == CMD_UNINSTALL
+                                   ? "VirtualBox extension pack uninstaller"
+                                   : "VirtualBox extension pack maintainer";
+            papszArgs[cSuArgs - 1] = "--";
+        }
+        else
+            RTMsgError("Failed to open /dev/null: %Rrc");
+    }
+    /*
+     * pkexec may work for ssh console sessions as well if the right agents
+     * are installed.  However it is very generic and does not allow for any
+     * custom messages.  Thus it comes after gksu.
+     */
+    else if (FindExecTool(szExecTool, sizeof(szExecTool), "pkexec"))
+    {
+        iSuArg = cSuArgs - 1;
+        papszArgs[cSuArgs - 1] = szExecTool;
+    }
+    /*
+     * The ultimate fallback is running 'su -' within an xterm.  We use the
+     * title of the xterm to tell what is going on.
+     */
+    else if (   fHaveDisplayVar
+             && FindExecTool(szExecTool, sizeof(szExecTool), "su")
+             && FindExecTool(szXterm, sizeof(szXterm), "xterm"))
+    {
+        rc = RTGetOptArgvToString(&pszCmdLine, &papszArgs[cSuArgs], RTGETOPTARGV_CNV_QUOTE_BOURNE_SH);
+        if (RT_SUCCESS(rc))
+        {
+            iSuArg = cSuArgs - 8;
+            papszArgs[cSuArgs - 8] = szXterm;
+            papszArgs[cSuArgs - 7] = "-T";
+            papszArgs[cSuArgs - 6] = papszArgs[cSuArgs - 1] = iCmd == CMD_INSTALL
+                                   ? "VirtualBox extension pack installer - su"
+                                   : iCmd == CMD_UNINSTALL
+                                   ? "VirtualBox extension pack uninstaller - su"
+                                   : "VirtualBox extension pack maintainer - su";
+            papszArgs[cSuArgs - 5] = "-e";
+            papszArgs[cSuArgs - 4] = szExecTool;
+            papszArgs[cSuArgs - 3] = "-c";
+            papszArgs[cSuArgs - 2] = pszCmdLine;
+            papszArgs[cSuArgs - 1] = "-";
+            papszArgs[cSuArgs] = NULL;
+        }
+        else
+            RTMsgError("RTGetOptArgvToString failed: %Rrc");
+    }
+    else if (fHaveDisplayVar)
+        RTMsgError("Unable to locate 'pkexec', 'pksu' or 'su+xterm'. Try perform the operation using VBoxManage running as root");
+    else
+        RTMsgError("Unable to locate 'pkexec'. Try perform the operation using VBoxManage running as root");
+    if (iSuArg != cSuArgs)
+    {
+        AssertRelease(iSuArg >= 0);
+
+        /*
+         * Argument list constructed, execute it and wait for the exec
+         * program to complete.
+         */
+        RTPROCESS hProcess;
+        rc = RTProcCreateEx(papszArgs[iSuArg], &papszArgs[iSuArg], RTENV_DEFAULT, 0 /*fFlags*/,
+                            NULL /*phStdIn*/, pStdNull, pStdNull, NULL /*pszAsUser*/,  NULL /*pszPassword*/,
+                            &hProcess);
+        if (RT_SUCCESS(rc))
+        {
+            RTPROCSTATUS Status;
+            rc = RTProcWait(hProcess, RTPROCWAIT_FLAGS_BLOCK, &Status);
+            if (RT_SUCCESS(rc))
+            {
+                if (Status.enmReason == RTPROCEXITREASON_NORMAL)
+                    rcExit = (RTEXITCODE)Status.iStatus;
+                else
+                    rcExit = RTEXITCODE_FAILURE;
+            }
+            else
+                RTMsgError("Error while waiting for '%s': %Rrc", papszArgs[iSuArg], rc);
+        }
+        else
+            RTMsgError("Failed to execute '%s': %Rrc", papszArgs[iSuArg], rc);
+    }
+    RTStrFree(pszCmdLine);
+    RTFileClose(StdNull.u.hFile);
+
 #endif
     return rcExit;
@@ -1260,6 +1446,7 @@
  * @param   argc                The number of arguments.
  * @param   argv                The arguments.
- */
-static RTEXITCODE RelaunchElevated(int argc, char **argv)
+ * @param   iCmd                The command that is being executed.
+ */
+static RTEXITCODE RelaunchElevated(int argc, char **argv, int iCmd)
 {
     /*
@@ -1307,9 +1494,10 @@
                  * change the order here.
                  */
+                int const    cSuArgs   = 10;
                 int          cArgs     = argc + 5 + 1;
-                char const **papszArgs = (char const **)RTMemTmpAllocZ((cArgs + 1) * sizeof(const char *));
+                char const **papszArgs = (char const **)RTMemTmpAllocZ((cSuArgs + cArgs + 1) * sizeof(const char *));
                 if (papszArgs)
                 {
-                    int iDst = 0;
+                    int iDst = cSuArgs;
                     papszArgs[iDst++] = argv[0];
                     papszArgs[iDst++] = "--stdout";
@@ -1324,5 +1512,5 @@
                      * Do the platform specific process execution (waiting included).
                      */
-                    rcExit = RelaunchElevatedNative(szExecPath, cArgs, papszArgs);
+                    rcExit = RelaunchElevatedNative(szExecPath, papszArgs, cSuArgs, cArgs, iCmd);
 
                     /*
@@ -1503,16 +1691,10 @@
     static const RTGETOPTDEF s_aOptions[] =
     {
-#define CMD_INSTALL     1000
         { "install",    CMD_INSTALL,    RTGETOPT_REQ_NOTHING },
-#define CMD_UNINSTALL   1001
         { "uninstall",  CMD_UNINSTALL,  RTGETOPT_REQ_NOTHING },
-#define CMD_CLEANUP     1002
         { "cleanup",    CMD_CLEANUP,    RTGETOPT_REQ_NOTHING },
 #ifdef WITH_ELEVATION
-# define OPT_ELEVATED    1090
         { "--elevated", OPT_ELEVATED,   RTGETOPT_REQ_NOTHING },
-# define OPT_STDOUT      1091
         { "--stdout",   OPT_STDOUT,     RTGETOPT_REQ_STRING  },
-# define OPT_STDERR      1092
         { "--stderr",   OPT_STDERR,     RTGETOPT_REQ_STRING  },
 #endif
@@ -1537,5 +1719,5 @@
 #ifdef WITH_ELEVATION
                 if (!fElevated)
-                    return RelaunchElevated(argc, argv);
+                    return RelaunchElevated(argc, argv, ch);
 #endif
                 int         cCmdargs     = argc - GetState.iNext;
