Changeset 68024 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Jul 18, 2017 1:54:10 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r67898 r68024 1384 1384 return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing VM name/UUID"); 1385 1385 1386 if (!pszSettingsFile) 1387 { 1388 if (!pszUser) 1389 return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing required --user (or --settings-file) option"); 1390 if (!pszPassword) 1391 return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing required --password (or --settings-file) option"); 1392 if (!pszIsoPath) 1393 return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing required --iso-path (or --settings-file) option"); 1394 } 1386 if (!pszSettingsFile && !pszIsoPath) 1387 return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing required --iso-path (or --settings-file) option"); 1395 1388 1396 1389 /* … … 1435 1428 Utf8Str(bstrUuid).c_str()); 1436 1429 1430 { 1431 /* 1432 * Instantiate and configure the unattended installer. 1433 */ 1434 ComPtr<IUnattended> ptrUnattended; 1435 CHECK_ERROR_BREAK(machine, CreateUnattendedInstaller(ptrUnattended.asOutParam())); 1436 1437 if (pszSettingsFile) 1438 CHECK_ERROR_BREAK(ptrUnattended, LoadSettings(Bstr(pszSettingsFile).raw())); 1439 1440 if (pszIsoPath) 1441 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(IsoPath)(Bstr(pszIsoPath).raw())); 1442 if (pszUser) 1443 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(User)(Bstr(pszUser).raw())); 1444 if (pszPassword) 1445 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(Password)(Bstr(pszPassword).raw())); 1446 if (pszFullUserName) 1447 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(FullUserName)(Bstr(pszFullUserName).raw())); 1448 if (pszProductKey) 1449 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(ProductKey)(Bstr(pszProductKey).raw())); 1450 if (pszAdditionsIsoPath) 1451 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(AdditionsIsoPath)(Bstr(pszAdditionsIsoPath).raw())); 1452 if (fInstallAdditions >= 0) 1453 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(InstallGuestAdditions)(fInstallAdditions != (int)false)); 1454 if (fSetImageIdx) 1455 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(ImageIndex)(idxImage)); 1456 if (pszAuxiliaryBasePath) 1457 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(AuxiliaryBasePath)(Bstr(pszAuxiliaryBasePath).raw())); 1458 1459 CHECK_ERROR_BREAK(ptrUnattended,Prepare()); 1460 CHECK_ERROR_BREAK(ptrUnattended,ConstructMedia()); 1461 CHECK_ERROR_BREAK(ptrUnattended,ReconfigureVM()); 1462 1463 /* 1464 * Retrieve and display the parameters actually used. 1465 */ 1466 RTPrintf("Using values:\n"); 1467 #define SHOW_ATTR(a_Attr, a_szText, a_Type, a_szFmt) do { \ 1468 a_Type Value; \ 1469 HRESULT hrc2 = ptrUnattended->COMGETTER(a_Attr)(&Value); \ 1470 if (SUCCEEDED(hrc2)) \ 1471 RTPrintf(" %22s = " a_szFmt "\n", a_szText, Value); \ 1472 else \ 1473 RTPrintf(" %22s = failed: %Rhrc\n", a_szText, hrc2); \ 1474 } while (0) 1475 #define SHOW_STR_ATTR(a_Attr, a_szText) do { \ 1476 Bstr bstrString; \ 1477 HRESULT hrc2 = ptrUnattended->COMGETTER(a_Attr)(bstrString.asOutParam()); \ 1478 if (SUCCEEDED(hrc2)) \ 1479 RTPrintf(" %22s = %ls\n", a_szText, bstrString.raw()); \ 1480 else \ 1481 RTPrintf(" %22s = failed: %Rhrc\n", a_szText, hrc2); \ 1482 } while (0) 1483 1484 SHOW_STR_ATTR(IsoPath, "isoPath"); 1485 SHOW_STR_ATTR(User, "user"); 1486 SHOW_STR_ATTR(Password, "password"); 1487 SHOW_STR_ATTR(FullUserName, "fullUserName"); 1488 SHOW_STR_ATTR(ProductKey, "productKey"); 1489 SHOW_STR_ATTR(AdditionsIsoPath, "additionsIsoPath"); 1490 SHOW_ATTR( InstallGuestAdditions, "installGuestAdditions", BOOL, "%RTbool"); 1491 SHOW_STR_ATTR(ValidationKitIsoPath, "validationKitIsoPath"); 1492 SHOW_ATTR( InstallTestExecService, "installTestExecService", BOOL, "%RTbool"); 1493 SHOW_STR_ATTR(AuxiliaryBasePath, "auxiliaryBasePath"); 1494 SHOW_ATTR( ImageIndex, "imageIndex", ULONG, "%u"); 1495 SHOW_STR_ATTR(ScriptTemplatePath, "scriptTemplatePath"); 1496 1497 #undef SHOW_STR_ATTR 1498 #undef SHOW_ATTR 1499 } 1500 1501 a->session->UnlockMachine(); 1502 1437 1503 /* 1438 * Instantiate and configure the unattended installer.1504 * Start the VM if requested. 1439 1505 */ 1440 ComPtr<IUnattended> unAttended; 1441 CHECK_ERROR_BREAK(machine, COMGETTER(Unattended)(unAttended.asOutParam())); 1442 1443 /* Always calls 'done' to clean up from any aborted previous session. */ 1444 CHECK_ERROR_BREAK(unAttended,Done()); 1445 1446 if (pszSettingsFile) 1447 CHECK_ERROR_BREAK(unAttended, LoadSettings(Bstr(pszSettingsFile).raw())); 1448 1449 if (pszIsoPath) 1450 CHECK_ERROR_BREAK(unAttended, COMSETTER(IsoPath)(Bstr(pszIsoPath).raw())); 1451 if (pszUser) 1452 CHECK_ERROR_BREAK(unAttended, COMSETTER(User)(Bstr(pszUser).raw())); 1453 if (pszPassword) 1454 CHECK_ERROR_BREAK(unAttended, COMSETTER(Password)(Bstr(pszPassword).raw())); 1455 if (pszFullUserName) 1456 CHECK_ERROR_BREAK(unAttended, COMSETTER(FullUserName)(Bstr(pszFullUserName).raw())); 1457 if (pszProductKey) 1458 CHECK_ERROR_BREAK(unAttended, COMSETTER(ProductKey)(Bstr(pszProductKey).raw())); 1459 if (pszAdditionsIsoPath) 1460 CHECK_ERROR_BREAK(unAttended, COMSETTER(AdditionsIsoPath)(Bstr(pszAdditionsIsoPath).raw())); 1461 if (fInstallAdditions >= 0) 1462 CHECK_ERROR_BREAK(unAttended, COMSETTER(InstallGuestAdditions)(fInstallAdditions != (int)false)); 1463 if (fSetImageIdx) 1464 CHECK_ERROR_BREAK(unAttended, COMSETTER(ImageIndex)(idxImage)); 1465 if (pszAuxiliaryBasePath) 1466 CHECK_ERROR_BREAK(unAttended, COMSETTER(AuxiliaryBasePath)(Bstr(pszAuxiliaryBasePath).raw())); 1467 1468 CHECK_ERROR_BREAK(unAttended,Prepare()); 1469 CHECK_ERROR_BREAK(unAttended,ConstructMedia()); 1470 CHECK_ERROR_BREAK(unAttended,ReconfigureVM()); 1471 CHECK_ERROR_BREAK(unAttended,Done()); 1472 1473 /* 1474 * Start the VM. 1475 */ 1476 a->session->UnlockMachine(); 1477 1506 if (RTStrICmp(pszSessionType, "none") != 0) 1478 1507 { 1479 1508 Bstr env; 1480 1481 1509 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) 1482 1510 /* make sure the VM process will start on the same display as VBoxManage */ … … 1520 1548 } 1521 1549 } 1522 } 1523 1524 /* 1525 * Retrieve and display the parameters actually used. 1526 */ 1527 Bstr bstrAdditionsIsoPath; 1528 CHECK_ERROR_BREAK(unAttended, COMGETTER(AdditionsIsoPath)(bstrAdditionsIsoPath.asOutParam())); 1529 BOOL fInstallGuestAdditions = FALSE; 1530 CHECK_ERROR_BREAK(unAttended, COMGETTER(InstallGuestAdditions)(&fInstallGuestAdditions)); 1531 Bstr bstrIsoPath; 1532 CHECK_ERROR_BREAK(unAttended, COMGETTER(IsoPath)(bstrIsoPath.asOutParam())); 1533 Bstr bstrUser; 1534 CHECK_ERROR_BREAK(unAttended, COMGETTER(User)(bstrUser.asOutParam())); 1535 Bstr bstrPassword; 1536 CHECK_ERROR_BREAK(unAttended, COMGETTER(Password)(bstrPassword.asOutParam())); 1537 Bstr bstrFullUserName; 1538 CHECK_ERROR_BREAK(unAttended, COMGETTER(FullUserName)(bstrFullUserName.asOutParam())); 1539 Bstr bstrProductKey; 1540 CHECK_ERROR_BREAK(unAttended, COMGETTER(ProductKey)(bstrProductKey.asOutParam())); 1541 Bstr bstrAuxiliaryBasePath; 1542 CHECK_ERROR_BREAK(unAttended, COMGETTER(AuxiliaryBasePath)(bstrAuxiliaryBasePath.asOutParam())); 1543 ULONG idxImageActual = 0; 1544 CHECK_ERROR_BREAK(unAttended, COMGETTER(ImageIndex)(&idxImageActual)); 1545 RTPrintf("Got values:\n" 1546 " user: %ls\n" 1547 " password: %ls\n" 1548 " fullUserName: %ls\n" 1549 " productKey: %ls\n" 1550 " image index: %u\n" 1551 " isoPath: %ls\n" 1552 " additionsIsoPath: %ls\n" 1553 " installGuestAdditions: %RTbool\n" 1554 " auxiliaryBasePath: %ls", 1555 bstrUser.raw(), 1556 bstrPassword.raw(), 1557 bstrFullUserName.raw(), 1558 bstrProductKey.raw(), 1559 idxImageActual, 1560 bstrIsoPath.raw(), 1561 bstrAdditionsIsoPath.raw(), 1562 fInstallGuestAdditions, 1563 bstrAuxiliaryBasePath.raw()); 1550 1551 /* 1552 * Do we wait for the VM to power down? 1553 */ 1554 } 1555 1564 1556 } while (0); 1565 1557
Note:
See TracChangeset
for help on using the changeset viewer.