Changeset 83870 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Apr 20, 2020 6:17:37 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r83607 r83870 2289 2289 #if 1 /* Only Windows is supported (and tested) at the moment. */ 2290 2290 if ( RT_SUCCESS(rc) 2291 && osType != eOSType_Windows) 2291 && ( osType != eOSType_Windows 2292 && osType != eOSType_Linux)) 2292 2293 { 2293 2294 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, … … 2324 2325 else 2325 2326 { 2326 /* Set default installation directories. */ 2327 Utf8Str strUpdateDir = "/tmp/"; 2328 if (osType == eOSType_Windows) 2329 strUpdateDir = "C:\\Temp\\"; 2327 Utf8Str strUpdateDir; 2330 2328 2331 2329 rc = setProgress(5); 2332 2333 /* Try looking up the Guest Additions installation directory. */2334 2330 if (RT_SUCCESS(rc)) 2335 2331 { … … 2353 2349 if (fUseInstallDir) 2354 2350 { 2355 if (RT_SUCCESS(rc)) 2356 rc = getGuestProperty(pGuest, "/VirtualBox/GuestAdd/InstallDir", strUpdateDir); 2351 rc = getGuestProperty(pGuest, "/VirtualBox/GuestAdd/InstallDir", strUpdateDir); 2357 2352 if (RT_SUCCESS(rc)) 2358 2353 { 2359 if ( osType == eOSType_Windows)2354 if (strUpdateDir.isNotEmpty()) 2360 2355 { 2361 strUpdateDir.findReplace('/', '\\'); 2362 strUpdateDir.append("\\Update\\"); 2356 if (osType == eOSType_Windows) 2357 { 2358 strUpdateDir.findReplace('/', '\\'); 2359 strUpdateDir.append("\\Update\\"); 2360 } 2361 else 2362 strUpdateDir.append("/update/"); 2363 2363 } 2364 else 2365 strUpdateDir.append("/update/"); 2364 /* else Older Guest Additions might not handle this property correctly. */ 2365 } 2366 /* Ditto. */ 2367 } 2368 2369 /** @todo Set fallback installation directory. Make this a *lot* smarter. Later. */ 2370 if (strUpdateDir.isEmpty()) 2371 { 2372 if (osType == eOSType_Windows) 2373 strUpdateDir = "C:\\Temp\\"; 2374 else 2375 strUpdateDir = "/tmp/"; 2376 } 2377 } 2378 2379 /* Create the installation directory. */ 2380 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 2381 if (RT_SUCCESS(rc)) 2382 { 2383 LogRel(("Guest Additions update directory is: %s\n", strUpdateDir.c_str())); 2384 2385 rc = pSession->i_directoryCreate(strUpdateDir, 755 /* Mode */, DirectoryCreateFlag_Parents, &rcGuest); 2386 if (RT_FAILURE(rc)) 2387 { 2388 switch (rc) 2389 { 2390 case VERR_GSTCTL_GUEST_ERROR: 2391 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 2392 break; 2393 2394 default: 2395 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2396 Utf8StrFmt(GuestSession::tr("Error creating installation directory \"%s\" on the guest: %Rrc"), 2397 strUpdateDir.c_str(), rc)); 2398 break; 2366 2399 } 2367 2400 } 2368 2401 } 2369 2402 2370 if (RT_SUCCESS(rc))2371 LogRel(("Guest Additions update directory is: %s\n",2372 strUpdateDir.c_str()));2373 2374 /* Create the installation directory. */2375 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;2376 rc = pSession->i_directoryCreate(strUpdateDir, 755 /* Mode */, DirectoryCreateFlag_Parents, &rcGuest);2377 if (RT_FAILURE(rc))2378 {2379 switch (rc)2380 {2381 case VERR_GSTCTL_GUEST_ERROR:2382 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest));2383 break;2384 2385 default:2386 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,2387 Utf8StrFmt(GuestSession::tr("Error creating installation directory \"%s\" on the guest: %Rrc"),2388 strUpdateDir.c_str(), rc));2389 break;2390 }2391 }2392 2403 if (RT_SUCCESS(rc)) 2393 2404 rc = setProgress(10); … … 2511 2522 } 2512 2523 case eOSType_Linux: 2513 /** @todo Add Linux support. */ 2524 { 2525 /* Copy over the installer to the guest but don't execute it. 2526 * Execution will be done by the shell instead. */ 2527 mFiles.push_back(ISOFile("VBOXLINUXADDITIONS.RUN", 2528 strUpdateDir + "VBoxLinuxAdditions.run", ISOFILE_FLAG_COPY_FROM_ISO)); 2529 2530 GuestProcessStartupInfo siInstaller; 2531 siInstaller.mName = "VirtualBox Linux Guest Additions Installer"; 2532 /* Set a running timeout of 5 minutes -- compiling modules and stuff for the Linux Guest Additions 2533 * setup can take quite a while, so be on the safe side. */ 2534 siInstaller.mTimeoutMS = 5 * 60 * 1000; 2535 /* The argv[0] should contain full path to the shell we're using to execute the installer. */ 2536 siInstaller.mArguments.push_back("/bin/sh"); 2537 /* Now add the stuff we need in order to execute the installer. */ 2538 siInstaller.mArguments.push_back(strUpdateDir + "VBoxLinuxAdditions.run"); 2539 /* Make sure to add "--nox11" to the makeself wrapper in order to not getting any blocking xterm 2540 * window spawned when doing any unattended Linux GA installations. */ 2541 siInstaller.mArguments.push_back("--nox11"); 2542 siInstaller.mArguments.push_back("--"); 2543 /* Force the upgrade. Needed in order to skip the confirmation dialog about warning to upgrade. */ 2544 siInstaller.mArguments.push_back("--force"); /** @todo We might want a dedicated "--silent" switch here. */ 2545 /* If the caller does not want to wait for out guest update process to end, 2546 * complete the progress object now so that the caller can do other work. */ 2547 if (mFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly) 2548 siInstaller.mFlags |= ProcessCreateFlag_WaitForProcessStartOnly; 2549 mFiles.push_back(ISOFile("/bin/sh" /* Source */, "/bin/sh" /* Dest */, 2550 ISOFILE_FLAG_EXECUTE, siInstaller)); 2514 2551 break; 2552 } 2515 2553 case eOSType_Solaris: 2516 2554 /** @todo Add Solaris support. */
Note:
See TracChangeset
for help on using the changeset viewer.