VirtualBox

Changeset 86648 in vbox


Ignore:
Timestamp:
Oct 20, 2020 1:59:45 PM (4 years ago)
Author:
vboxsync
Message:

bugref:9781. Added the placeholder @@VBOX_COND_GUEST_VERSION[>(required version)]@@. Updated the templates. Removed the obsolete function getGuestOSConditional().

Location:
trunk/src
Files:
22 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/installer/vboxadd.sh

    r84947 r86648  
    356356        echo "KERNEL=${udev_fix}\"vboxuser\", NAME=\"vboxuser\", OWNER=\"vboxadd\", MODE=\"0666\"" >> /etc/udev/rules.d/60-vboxadd.rules
    357357        # Make sure the new rule is noticed.
    358         udevadm control --reload >/dev/null 2>&1 || true
     358        udevadm control --reload-rules >/dev/null 2>&1 || true
    359359        udevcontrol reload_rules >/dev/null 2>&1 || true
    360360    fi
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp

    r85631 r86648  
    11131113                        case VirtualSystemDescriptionType_CloudPublicSSHKey:
    11141114                        case VirtualSystemDescriptionType_BootingFirmware:
     1115                        case VirtualSystemDescriptionType_CloudInstanceMetadata:
     1116                        case VirtualSystemDescriptionType_CloudInstanceFreeFormTags:
     1117                        case VirtualSystemDescriptionType_CloudImageFreeFormTags:
     1118
    11151119                            /** @todo  VirtualSystemDescriptionType_Miscellaneous? */
    11161120                            break;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloud.cpp

    r86153 r86648  
    123123    int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0);
    124124    AssertRCReturn(vrc, RTEXITCODE_FAILURE);
    125     if (a->argc == iFirst)
    126     {
    127         RTPrintf("Empty command parameter list, show help.\n");
    128         printHelp(g_pStdOut);
    129         return RTEXITCODE_SUCCESS;
    130     }
    131125
    132126    Utf8Str strCompartmentId;
     
    295289    int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0);
    296290    AssertRCReturn(vrc, RTEXITCODE_FAILURE);
    297     if (a->argc == iFirst)
    298     {
    299         RTPrintf("Empty command parameter list, show help.\n");
    300         printHelp(g_pStdOut);
    301         return RTEXITCODE_SUCCESS;
    302     }
    303291
    304292    Utf8Str strCompartmentId;
     
    542530
    543531    Utf8Str strDisplayName, strImageId, strBootVolumeId, strPublicSSHKey;
     532    bool fKeyPresented = false;
    544533    int c;
    545534    while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0)
     
    603592                pVSD->AddDescription(VirtualSystemDescriptionType_CloudPublicSSHKey,
    604593                                     Bstr(ValueUnion.psz).raw(), NULL);
     594                fKeyPresented = true;
    605595                break;
    606596            case 1001:
     
    620610        return RTEXITCODE_FAILURE;
    621611
    622     if (strPublicSSHKey.isEmpty())
    623         RTPrintf("Warning!!! Public SSH key doesn't present in the passed arguments...\n");
     612    if ( fKeyPresented )
     613        if (strPublicSSHKey.isEmpty())
     614            RTPrintf("Warning!!! The value of the passed public SSH key is empty...\n");
     615    else
     616        return errorArgument("Parameter --public-ssh-key is absent. if there is no need to pass a key just use the form"
     617                             " '--public-ssh-key='.");
    624618
    625619    if (strImageId.isNotEmpty() && strBootVolumeId.isNotEmpty())
     
    787781    };
    788782
    789     const size_t vsdHReadableArraySize = 12;//the number of items in the vsdHReadableArray
     783    const size_t vsdHReadableArraySize = 14;//the number of items in the vsdHReadableArray
    790784    vsdHReadable vsdHReadableArray[vsdHReadableArraySize] = {
    791785        {VirtualSystemDescriptionType_CloudDomain, "Availability domain = %ls\n", "Availability domain wasn't found\n"},
     
    802796        {VirtualSystemDescriptionType_CPU, "CPUs = %ls\n", "Numbers of CPUs weren't found\n"},
    803797        {VirtualSystemDescriptionType_CloudPublicIP, "Instance public IP = %ls\n", "Public IP wasn't found\n"},
    804         {VirtualSystemDescriptionType_Miscellaneous, "%ls\n", "Free-form tags or metadata weren't found\n"}
     798        {VirtualSystemDescriptionType_CloudInstanceMetadata, "%ls\n", "Metadata weren't found\n"},
     799        {VirtualSystemDescriptionType_CloudInstanceFreeFormTags, "%ls\n", "Instance free-form tags weren't found\n"},
     800        {VirtualSystemDescriptionType_CloudImageFreeFormTags, "%ls\n", "Image free-form tags weren't found\n"}
     801
    805802    };
    806803
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r85121 r86648  
    363363                }
    364364#endif
     365                break;
     366            }
     367
     368            case VBoxEventType_OnProgressPercentageChanged:
     369            {
     370                ComPtr<IProgressPercentageChangedEvent> pV = aEvent;
     371                Assert(pV);
     372                LONG percent = 0;
     373                pV->COMGETTER(Percent)(&percent);
     374                {
     375                    LogRel(("VBoxSDLEventListener: got the percent %d from the event "
     376                            "VBoxEventType_OnProgressPercentageChanged.\n", percent));
     377                    RTPrintf("VBoxSDLEventListener: got the percent %d from the event "
     378                             "VBoxEventType_OnProgressPercentageChanged.\n", percent);
     379                }
    365380                break;
    366381            }
     
    597612                }
    598613#endif /* !RT_OS_DARWIN */
     614                break;
     615            }
     616
     617            case VBoxEventType_OnProgressPercentageChanged:
     618            {
     619                ComPtr<IProgressPercentageChangedEvent> pV = aEvent;
     620                Assert(pV);
     621                LONG percent = 0;
     622                pV->COMGETTER(Percent)(&percent);
     623                {
     624                    LogRel(("VBoxSDLConsoleEventListener: got the percent %d from the event "
     625                            "VBoxEventType_OnProgressPercentageChanged.\n", percent));
     626                    RTPrintf("VBoxSDLConsoleEventListener: got the percent %d from the event "
     627                             "VBoxEventType_OnProgressPercentageChanged.\n", percent);
     628                }
    599629                break;
    600630            }
     
    21082138        com::SafeArray<VBoxEventType_T> eventTypes;
    21092139        eventTypes.push_back(VBoxEventType_OnExtraDataChanged);
     2140
     2141        eventTypes.push_back(VBoxEventType_OnProgressPercentageChanged);
    21102142        CHECK_ERROR(pES, RegisterListener(pVBoxListener, ComSafeArrayAsInParam(eventTypes), true));
    21112143    }
     
    21252157        eventTypes.push_back(VBoxEventType_OnCanShowWindow);
    21262158        eventTypes.push_back(VBoxEventType_OnShowWindow);
     2159        eventTypes.push_back(VBoxEventType_OnProgressPercentageChanged);
    21272160        CHECK_ERROR(pES, RegisterListener(pConsoleListener, ComSafeArrayAsInParam(eventTypes), true));
    21282161        // until we've tried to to start the VM, ignore power off events
     
    23722405                    case SDL_USER_EVENT_XPCOM_EVENTQUEUE:
    23732406                    {
    2374                         LogFlow(("SDL_USER_EVENT_XPCOM_EVENTQUEUE: processing XPCOM event queue...\n"));
     2407//                      LogFlow(("SDL_USER_EVENT_XPCOM_EVENTQUEUE: processing XPCOM event queue...\n"));
    23752408                        eventQ->processEventQueue(0);
    23762409                        signalXPCOMEventQueueThread();
  • trunk/src/VBox/Main/UnattendedTemplates/ol_ks.cfg

    r86269 r86648  
    8282glibc-headers
    8383gcc
    84 @@VBOX_GUEST_OS_COND_VERSION@@**8.0.0**
     84@@VBOX_COND_GUEST_VERSION[>8.0.0]@@
    8585elfutils-libelf-devel
    86 @@VBOX_GUEST_OS_COND_END@@
     86@@VBOX_COND_END@@
    8787dkms
    8888make
  • trunk/src/VBox/Main/UnattendedTemplates/ol_postinstall.sh

    r86276 r86648  
    202202log_command_in_target yum -y install binutils
    203203log_command_in_target yum -y install make
    204 @@VBOX_GUEST_OS_COND_VERSION@@**8.0.0**
     204@@VBOX_COND_GUEST_VERSION[>8.0.0]@@
    205205log_command_in_target yum -y install elfutils-libelf-devel
    206 @@VBOX_GUEST_OS_COND_END@@
     206@@VBOX_COND_END@@
    207207log_command_in_target yum -y install dkms
    208208log_command_in_target yum -y install make
  • trunk/src/VBox/Main/UnattendedTemplates/redhat67_ks.cfg

    r86269 r86648  
    8282glibc-headers
    8383gcc
    84 @@VBOX_GUEST_OS_COND_VERSION@@**8.0.0**
     84@@VBOX_COND_GUEST_VERSION[>8.0.0]@@
    8585elfutils-libelf-devel
    86 @@VBOX_GUEST_OS_COND_END@@
     86@@VBOX_COND_END@@
    8787dkms
    8888make
  • trunk/src/VBox/Main/UnattendedTemplates/redhat_postinstall.sh

    r86269 r86648  
    178178log_command_in_target yum -y install binutils
    179179log_command_in_target yum -y install make
    180 @@VBOX_GUEST_OS_COND_VERSION@@**8.0.0**
     180@@VBOX_COND_GUEST_VERSION[>8.0.0]@@
    181181log_command_in_target yum -y install elfutils-libelf-devel
    182 @@VBOX_GUEST_OS_COND_END@@
     182@@VBOX_COND_END@@
    183183log_command_in_target yum -y install dkms
    184184log_command_in_target yum -y install make
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r86553 r86648  
    41784178  <enum
    41794179    name="VirtualSystemDescriptionType"
    4180     uuid="6e18c6d7-e1b7-4cb0-9706-1f31d18248f8"
     4180    uuid="70c5ca7b-65a8-49cc-9b19-e80192b9db1d"
    41814181    >
    41824182    <desc>Used with <link to="IVirtualSystemDescription" /> to describe the type of
     
    42464246    <const name="CloudPublicSSHKey" value="48" />
    42474247    <const name="BootingFirmware" value="49" />
     4248    <const name="CloudInstanceMetadata" value="50" />
     4249    <const name="CloudInstanceFreeFormTags" value="51" />
     4250    <const name="CloudImageFreeFormTags" value="52" />
    42484251    <const name="HardDiskControllerVirtioSCSI" value="60" />
    42494252  </enum>
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r86509 r86648  
    145145    static void i_exportOPCThreadTask(TaskOPC *pTask);
    146146    static void i_importOrExportCloudThreadTask(TaskCloud *pTask);
     147
     148    HRESULT i_findFirstBootableImage(ComPtr<IMedium>& bootMedium, const ComPtr<IMachine> &pMachine);
    147149
    148150    HRESULT i_initBackendNames();
  • trunk/src/VBox/Main/include/ProgressImpl.h

    r85251 r86648  
    157157    static DECLCALLBACK(int) i_vdProgressCallback(void *pvUser, unsigned uPercentage);
    158158
     159    HRESULT i_addOperations(ULONG cOperations, ULONG ulTotalOperationsWeight);
    159160protected:
    160161    DECLARE_EMPTY_CTOR_DTOR(Progress)
  • trunk/src/VBox/Main/include/UnattendedInstaller.h

    r86270 r86648  
    520520/**
    521521 * RHEL 7 installer (same as RHEL 6).
     522 * The class was added for better handling any possible subtle difference between RHEL6 and RHEL7.
    522523 */
    523524class UnattendedRhel7Installer : public UnattendedRhel6Installer
     
    540541/**
    541542 * RHEL 8 installer (same as RHEL 7).
     543 * The class was added for better handling any possible subtle difference between RHEL7 and RHEL8.
    542544 */
    543545class UnattendedRhel8Installer : public UnattendedRhel7Installer
     
    605607
    606608/**
    607  * Oracle Linux 6 installer.
     609 * Oracle Linux 6 installer.
     610 * (same as RHEL 6, except for the templates).
     611 * The reason of adding new class is to sepatate the RHEL from OL.
    608612 */
    609613class UnattendedOracleLinux6Installer : public UnattendedRhel6Installer
     
    621625
    622626/**
    623  * Oracle Linux 7 installer.
     627 * Oracle Linux 7 installer. Same as OL 6.
     628 * The class was added for better handling any possible subtle difference between OL6 and OL7.
    624629 */
    625630class UnattendedOracleLinux7Installer : public UnattendedOracleLinux6Installer
     
    641646
    642647/**
    643  * Oracle Linux 8 installer.
     648 * Oracle Linux 8 installer. Same as OL 7.
     649 * The class was added for better handling any possible subtle difference between OL7 and OL8.
    644650 */
    645651class UnattendedOracleLinux8Installer : public UnattendedOracleLinux7Installer
  • trunk/src/VBox/Main/include/UnattendedScript.h

    r86274 r86648  
    9696    virtual HRESULT getConditional(const char *pachPlaceholder, size_t cchPlaceholder, bool *pfOutputting);
    9797
    98 
    99     /**
    100      * Get the result of a conditional for special version of guest OS.
    101      *
    102      * @returns COM status code.
    103      * @param   pachPlaceholder     The placholder string.  Not zero terminated.
    104      * @param   cchPlaceholder      The length of the placeholder.
    105      * @param   cchContent          The length of placeholder content.
    106      * @param   pcchCorrect         The length of part which must be excluded from the final content of
    107      *                              the placeholder.
    108      * @param   pfOutputting        Where to return the result of the conditional.
    109      *                              This holds the current outputting state on input
    110      *                              in case someone want to sanity check anything.
    111      */
    112     virtual HRESULT getGuestOSConditional(const char *pachPlaceholder,
    113                                           size_t cchPlaceholder,
    114                                           size_t cchContent,
    115                                           size_t *pcchCorrect,
    116                                           bool *pfOutputting);
    11798};
    11899
  • trunk/src/VBox/Main/src-all/ProgressImpl.cpp

    r85307 r86648  
    321321
    322322// public methods only for internal purposes
     323 
     324HRESULT Progress::i_addOperations(ULONG cOperations, ULONG ulTotalOperationsWeight)
     325{
     326    m_cOperations += cOperations;
     327    m_ulTotalOperationsWeight += ulTotalOperationsWeight;
     328    return S_OK;
     329}
    323330////////////////////////////////////////////////////////////////////////////////
    324331
     
    10591066    m_ulOperationPercent = 0;
    10601067
    1061     LogThisFunc(("%s: aNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",
     1068    LogRel(("%s: aNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",
    10621069                 m_operationDescription.c_str(), aNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight));
    10631070
  • trunk/src/VBox/Main/src-server/ApplianceImpl.cpp

    r86509 r86648  
    2626#include <VBox/com/array.h>
    2727#include <map>
     28#include <stack>
    2829
    2930#include "ApplianceImpl.h"
     
    14091410}
    14101411
     1412HRESULT Appliance::i_findFirstBootableImage(ComPtr<IMedium>& bootMedium, const ComPtr<IMachine> &pMachine)
     1413{
     1414    HRESULT hrc = S_OK;
     1415    LogFlowFuncEnter();
     1416
     1417    const ComPtr<IMachine> &baseMachine = pMachine;
     1418    try
     1419    {
     1420        /* Fetch all available storage controllers */
     1421        com::SafeIfaceArray<IStorageController> aStorageControllers;
     1422//      AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1423        hrc = baseMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(aStorageControllers));
     1424//      alock.release();
     1425        bool fBootMediumFound = false;
     1426        ComPtr<IMedium> ptrBootMedium;
     1427        std::stack <StorageBus_T> aBuses;
     1428        //insert buses in priority StorageBus_IDE - highest, StorageBus_SAS - lowest
     1429        aBuses.push(StorageBus_SAS);
     1430        aBuses.push(StorageBus_SCSI);
     1431        aBuses.push(StorageBus_SATA);
     1432        aBuses.push(StorageBus_IDE);
     1433
     1434        while (!aBuses.empty())
     1435        {
     1436            Bstr    bstrControllerName;
     1437            Utf8Str strControllerName;
     1438            ComPtr<IStorageController> sc;
     1439            StorageBus_T eTargetStorageBusType = aBuses.top();
     1440            StorageBus_T eSourceStorageBusType;
     1441            bool f = false;
     1442
     1443            for (size_t i=0; i<aStorageControllers.size(); ++i)
     1444            {
     1445                sc = aStorageControllers[i];
     1446                sc->COMGETTER(Name)(bstrControllerName.asOutParam());
     1447                sc->COMGETTER(Bus)(&eSourceStorageBusType);
     1448                if (eSourceStorageBusType == eTargetStorageBusType)
     1449                {
     1450                    f = true;
     1451                    break;
     1452                }
     1453            }
     1454
     1455            if (!f)
     1456            {
     1457                aBuses.pop();
     1458                continue;
     1459            }
     1460
     1461            com::SafeIfaceArray<IMediumAttachment> aMediumAttachments;
     1462            hrc = baseMachine->GetMediumAttachmentsOfController(bstrControllerName.raw(),
     1463                                                                ComSafeArrayAsOutParam(aMediumAttachments));
     1464
     1465            strControllerName = bstrControllerName;
     1466            AssertLogRelReturn(strControllerName.isNotEmpty(), setErrorBoth(E_UNEXPECTED, VERR_INTERNAL_ERROR_2));
     1467
     1468            for (size_t j = 0; j < aMediumAttachments.size(); j++)
     1469            {
     1470                //some checks just in case
     1471                LONG iPort = -1;
     1472                hrc = aMediumAttachments[j]->COMGETTER(Port)(&iPort);
     1473                AssertComRCReturn(hrc, hrc);
     1474
     1475                LONG iDevice = -1;
     1476                hrc = aMediumAttachments[j]->COMGETTER(Device)(&iDevice);
     1477                AssertComRCReturn(hrc, hrc);
     1478
     1479                DeviceType_T enmType;
     1480                hrc = aMediumAttachments[j]->COMGETTER(Type)(&enmType);
     1481                AssertComRCReturn(hrc, hrc);
     1482
     1483                if (enmType == DeviceType_HardDisk)
     1484                {
     1485                    ComPtr<IMedium> ptrMedium;
     1486                    hrc = aMediumAttachments[j]->COMGETTER(Medium)(ptrMedium.asOutParam());
     1487                    AssertComRCReturn(hrc, hrc);
     1488
     1489                    if (ptrMedium.isNotNull())
     1490                    {
     1491                        ptrBootMedium = ptrMedium;
     1492                        fBootMediumFound = true;
     1493                        break;
     1494                    }
     1495                }
     1496            }
     1497
     1498            if (fBootMediumFound)
     1499            {
     1500                hrc = S_OK;
     1501                break;
     1502            }
     1503            else
     1504                aBuses.pop();
     1505        }
     1506
     1507        if (ptrBootMedium != NULL && !ptrBootMedium.isNull())
     1508            ptrBootMedium.queryInterfaceTo(bootMedium.asOutParam());
     1509    }
     1510    catch (HRESULT erc)
     1511    {
     1512        hrc = setError(erc, tr("Exception during finding a bootable disk "));
     1513    }
     1514
     1515    LogFlowFuncLeave();
     1516    return hrc;
     1517}
     1518
    14111519void i_parseURI(Utf8Str strUri, LocationInfo &locInfo)
    14121520{
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r85364 r86648  
    712712        try
    713713        {
     714            alock.release();
    714715            rc = i_writeCloudImpl(m->locInfo, progress);
     716            alock.acquire();
    715717        }
    716718        catch (HRESULT aRC)
     
    883885HRESULT Appliance::i_writeCloudImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
    884886{
     887    HRESULT hrc = S_OK;
     888
    885889    for (list<ComObjPtr<VirtualSystemDescription> >::const_iterator
    886890         it = m->virtualSystemDescriptions.begin();
     
    897901        }
    898902
    899         //remove all disks from the VirtualSystemDescription exept one
     903        //Detect bootable disk and remove others from the VirtualSystemDescription
     904        ComPtr<IMedium> pBootableMedium;
     905        hrc = i_findFirstBootableImage(pBootableMedium, vsdescThis->m->pMachine);
     906
     907        if (FAILED(hrc))
     908            throw hrc;
     909        if (pBootableMedium.isNull())
     910            throw hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("Could not find any bootable disk"));
     911
     912        ComPtr<IMedium> pBootableBaseMedium;
     913        // returns pBootableMedium if there are no diff images
     914        hrc = pBootableMedium->COMGETTER(Base)(pBootableBaseMedium.asOutParam());
     915        if (FAILED(hrc))
     916            throw hrc;
     917
     918        //Get base bootable disk location
     919        Bstr bstrBootLocation;
     920        hrc = pBootableBaseMedium->COMGETTER(Location)(bstrBootLocation.asOutParam());
     921        if (FAILED(hrc)) throw hrc;
     922        Utf8Str strBootLocation = bstrBootLocation;
     923
    900924        skipped = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
    901925        itSkipped = skipped.begin();
    902 
    903         Utf8Str strBootLocation;
    904926        while (itSkipped != skipped.end())
    905927        {
    906             if (strBootLocation.isEmpty())
    907                 strBootLocation = (*itSkipped)->strVBoxCurrent;
     928            Utf8Str path = (*itSkipped)->strVBoxCurrent;
     929            // Locate the Medium object for this entry (by location/path).
     930            Log(("Finding disk \"%s\"\n", path.c_str()));
     931            ComObjPtr<Medium> ptrSourceDisk;
     932            hrc = mVirtualBox->i_findHardDiskByLocation(path, true , &ptrSourceDisk);
     933            if (FAILED(hrc))
     934                throw hrc;
     935
     936            if (!path.equalsIgnoreCase(strBootLocation))
     937                (*itSkipped)->skipIt = true;
    908938            else
    909                 (*itSkipped)->skipIt = true;
     939                LogRel(("Possible bootable disk \"%s\"\n", path.c_str()));
     940
    910941            ++itSkipped;
    911942        }
     
    932963
    933964    // Create a progress object here otherwise Task won't be created successfully
    934     HRESULT hrc = aProgress.createObject();
     965    hrc = aProgress.createObject();
    935966    if (SUCCEEDED(hrc))
    936967    {
  • trunk/src/VBox/Main/src-server/UnattendedScript.cpp

    r86336 r86648  
    5959    static const char s_szPrefixCond[]     = "@@VBOX_COND_";
    6060    static const char s_szPrefixCondEnd[]  = "@@VBOX_COND_END@@";
    61     static const char s_szPrefixCondGuestOs[]     = "@@VBOX_GUEST_OS_COND_";
    62     static const char s_szPrefixCondGuestOsEnd[]  = "@@VBOX_GUEST_OS_COND_END@@";
    6361
    6462    struct
     
    7169    size_t      offTemplate = 0;
    7270    size_t      cchTemplate = mStrScriptFullContent.length();
    73     size_t      cchInternalCorrect = 0;//used in logic handling the placeholder @@VBOX_GUEST_OS_COND_XXX@@
    7471    rStrDst.setNull();
    7572    for (;;)
     
    8683                try
    8784                {
    88                     rStrDst.append(mStrScriptFullContent, offTemplate + cchInternalCorrect, cchToCopy - + cchInternalCorrect);
     85                    rStrDst.append(mStrScriptFullContent, offTemplate, cchToCopy);
    8986                }
    9087                catch (std::bad_alloc &)
     
    9592            }
    9693            offTemplate += cchToCopy;
    97             cchInternalCorrect = 0;//don't forget to reset
    9894        }
    9995
     
    111107            while (   offPlaceholder + cchPlaceholder < cchTemplate
    112108                   && (ch = pszPlaceholder[cchPlaceholder]) != '\0'
    113                    && (   ch == '_'
     109                   && (   ch == '_' || ch == '[' || ch == ']' || ch == '.' || ch == '>' || ch == '<'
    114110                       || RT_C_IS_UPPER(ch)
    115111                       || RT_C_IS_DIGIT(ch)) )
     
    128124                || pszPlaceholder[cchPlaceholder - 2] != '@'
    129125                || (   strncmp(pszPlaceholder, s_szPrefixInsert, sizeof(s_szPrefixInsert) - 1) != 0
    130                     && strncmp(pszPlaceholder, s_szPrefixCond,   sizeof(s_szPrefixCond)   - 1) != 0
    131                     && strncmp(pszPlaceholder, s_szPrefixCondGuestOs,   sizeof(s_szPrefixCondGuestOs) - 1) != 0) )
     126                    && strncmp(pszPlaceholder, s_szPrefixCond,   sizeof(s_szPrefixCond)   - 1) != 0 ) )
    132127            {
    133128                hrc = mpSetError->setError(E_FAIL, mpSetError->tr("Malformed template placeholder '%.*s'"),
     
    188183             *                    one from the condition.
    189184             */
    190             else if ( strncmp(pszPlaceholder, s_szPrefixCond, sizeof(s_szPrefixCond) - 1U) == 0 )
    191             {
     185            else
     186            {
     187                Assert(strncmp(pszPlaceholder, s_szPrefixCond, sizeof(s_szPrefixCond) - 1) == 0);
    192188                if (cConds + 1 < RT_ELEMENTS(aConds))
    193189                {
     
    195191                    bool fNewOutputting = fOutputting;
    196192                    hrc = getConditional(pszPlaceholder, cchPlaceholder, &fNewOutputting);
    197                     if (SUCCEEDED(hrc))
    198                         fOutputting = fOutputting && fNewOutputting;
    199                     else
    200                         break;
    201                     cConds++;
    202                 }
    203                 else
    204                 {
    205                     hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR,
    206                                                    mpSetError->tr("Too deep conditional nesting at offset %zu (%#zx)"),
    207                                                    offPlaceholder, offPlaceholder);
    208                     break;
    209                 }
    210             }
    211             /*
    212              * @@VBOX_GUEST_OS_COND_END@@: Pop one item of the conditional stack.
    213              */
    214             else if ( strncmp(pszPlaceholder, s_szPrefixCondGuestOsEnd, sizeof(s_szPrefixCondGuestOsEnd) - 1U) == 0 )
    215             {
    216                 if (cConds > 0)
    217                 {
    218                     cConds--;
    219                     fOutputting = aConds[cConds].fSavedOutputting;
    220                 }
    221                 else
    222                 {
    223                     hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR,
    224                                                    mpSetError->tr("%s without @@VBOX_GUEST_OS_COND_XXX@@ at offset %zu (%#zx)"),
    225                                                    s_szPrefixCondGuestOsEnd, offPlaceholder, offPlaceholder);
    226                     break;
    227                 }
    228             }
    229             /*
    230              * @@VBOX_GUEST_OS_COND_XXX@@: Push the previous outputting state and combine it with the
    231              *                             one from the condition.
    232              */
    233             else
    234             {
    235                 Assert(strncmp(pszPlaceholder, s_szPrefixCondGuestOs, sizeof(s_szPrefixCondGuestOs) - 1) == 0);
    236                 if (cConds + 1 < RT_ELEMENTS(aConds))
    237                 {
    238                     aConds[cConds].fSavedOutputting = fOutputting;
    239                     bool fNewOutputting = fOutputting;
    240 
    241                     //offTemplate is the beginning of content, offEndContent is the end of content
    242                     //@@PLACEHOLDER_BEGIN@@Content@@PLACEHOLDER_END@@
    243                     //                    ^       ^
    244                     //                    |       |
    245                     //             offTemplate  offEndContent
    246                     size_t offEndContent = mStrScriptFullContent.find(s_szPrefix, offTemplate);
    247                     size_t cchContent = offEndContent - offTemplate - 1;
    248                     hrc = getGuestOSConditional(pszPlaceholder, cchPlaceholder, cchContent, &cchInternalCorrect, &fNewOutputting);
    249193                    if (SUCCEEDED(hrc))
    250194                        fOutputting = fOutputting && fNewOutputting;
     
    499443}
    500444
    501 HRESULT UnattendedScriptTemplate::getGuestOSConditional(const char *pachPlaceholder,
    502                                                         size_t cchPlaceholder,
    503                                                         size_t cchContent,
    504                                                         size_t *cchCorrect,
    505                                                         bool *pfOutputting)
    506 {
    507 #define IS_PLACEHOLDER_MATCH(a_szMatch) \
    508         (   cchPlaceholder == sizeof("@@VBOX_GUEST_OS_COND_" a_szMatch "@@") - 1U \
    509          && memcmp(pachPlaceholder, "@@VBOX_GUEST_OS_COND_" a_szMatch "@@", sizeof("@@VBOX_GUEST_OS_COND_" a_szMatch "@@") - 1U) == 0)
    510 
    511     if ( IS_PLACEHOLDER_MATCH("VERSION") )
    512     {
    513         Utf8Str strT(pachPlaceholder + cchPlaceholder, cchContent);
    514         RTCList<RTCString> partList = strT.split("**");
    515         Utf8Str strRequiredOSVersion;
    516         if (partList.size() == 2)//when the version is placed together with the placeholder in one line in the file
    517         {
    518             //The case when the string has been splitted on the 2 parts:
    519             //1. OS version
    520             //2. Actual content
    521             strRequiredOSVersion.assign(partList.at(0));
    522             //cchCorrect = "**" + length of OS version string + "**"
    523             *cchCorrect = 2 + partList.at(0).length() + 2;// must be subtracted from the cchContent
    524         }
    525         else if (partList.size() == 3)//when the version is placed on a standalone line in the file
    526         {
    527             //The case when the string has been splitted on the 3 parts:
    528             //1. Empty string or string with only "\n"
    529             //2. OS version
    530             //3. Actual content
    531             strRequiredOSVersion.assign(partList.at(1));
    532             *cchCorrect = 2 + partList.at(0).length() + partList.at(1).length() + 2;// must be subtracted from the cchContent
    533         }
    534         else//case with wrong string syntax
    535         {
    536             *cchCorrect = 0;
    537             *pfOutputting = false;
    538             LogRel(("Malformed content of the template @@VBOX_GUEST_OS_COND_VERSION@@\n"));
    539             return S_OK;
    540         }
    541 
    542         if (strRequiredOSVersion.isEmpty())
    543             *pfOutputting = false;
    544         else
    545         {
    546             Utf8Str strDetectedOSVersion = mpUnattended->i_getDetectedOSVersion();
    547             RTCList<RTCString> partListRequired = strRequiredOSVersion.split(".");
    548             RTCList<RTCString> partListDetected = strDetectedOSVersion.split(".");
    549             *pfOutputting = false;//initially is set to "false"
    550 
    551             /** @todo r=vvp: Should we check the string with a requested OS version for digits?
    552              *        (with RTLocCIsDigit()) */
    553             //Major version must be presented
    554             if ( partListDetected.at(0).toUInt32() >= partListRequired.at(0).toUInt32() )//comparison major versions
    555             {
    556                 //OS major versions are equal or detected guest OS major version is greater. Go further.
    557                 if (partListDetected.size() > 1 && partListRequired.size() > 1)//comparison minor versions
    558                 {
    559                     if (partListDetected.at(1).toUInt32() >= partListRequired.at(1).toUInt32())
    560                         //OS minor versions are equal or detected guest OS minor version is greater. Go further.
    561                         *pfOutputting = true;
    562                     else
    563                         //The detected guest OS minor version is less than the requested one.
    564                         *pfOutputting = false;
    565                 }
    566                 else
    567                     //OS minor versions are absent.
    568                     *pfOutputting = true;
    569             }
    570             else
    571                 //The detected guest OS major version is less than the requested one.
    572                 *pfOutputting = false;
    573         }
    574     }
    575     else
    576         return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown conditional placeholder '%.*s'"),
    577                                         cchPlaceholder, pachPlaceholder);
    578     return S_OK;
    579 #undef IS_PLACEHOLDER_MATCH
    580 }
    581 
    582445HRESULT UnattendedScriptTemplate::getConditional(const char *pachPlaceholder, size_t cchPlaceholder, bool *pfOutputting)
    583446{
     
    585448        (   cchPlaceholder == sizeof("@@VBOX_COND_" a_szMatch "@@") - 1U \
    586449         && memcmp(pachPlaceholder, "@@VBOX_COND_" a_szMatch "@@", sizeof("@@VBOX_COND_" a_szMatch "@@") - 1U) == 0)
     450
     451#define IS_PLACEHOLDER_PARTIALLY_MATCH(a_szMatch) \
     452        (memcmp(pachPlaceholder, "@@VBOX_COND_" a_szMatch, sizeof("@@VBOX_COND_" a_szMatch) - 1U) == 0)
    587453
    588454    /* Install Guest Additions: */
     
    623489    else if (IS_PLACEHOLDER_MATCH("HAS_PROXY"))
    624490        *pfOutputting = mpUnattended->i_getProxy().isNotEmpty();
     491    else if (IS_PLACEHOLDER_PARTIALLY_MATCH("GUEST_VERSION"))
     492    {
     493        //parse the placeholder and extract the OS version from there
     494        RTCString strPlaceHolder(pachPlaceholder);
     495        size_t startPos = sizeof("@@VBOX_COND_GUEST_VERSION") - 1;//-1 is for '\n'
     496        size_t endPos = strPlaceHolder.find("@@", startPos + 2);
     497        //next part should look like [>8.0.0] for example where:
     498        // - "[,]" is just the brackets to wrap up the condition;
     499        // - ">" is "greater". Also possible comparison is "<";
     500        // - 8.0.0 is required guest OS version.
     501        //The end of placeholder is "@@" like for others.
     502
     503        if ( strPlaceHolder[endPos] == '@'
     504             && strPlaceHolder[endPos+1] == '@' )
     505        {
     506            if ( strPlaceHolder[startPos++] == '[' && strPlaceHolder[--endPos] == ']' )
     507            {
     508                char chComp = strPlaceHolder[startPos++];
     509                RTCString strRequiredOSVersion = strPlaceHolder.substr(startPos, endPos - startPos);
     510                RTCString strDetectedOSVersion = mpUnattended->i_getDetectedOSVersion();
     511                int res = RTStrVersionCompare(strDetectedOSVersion.c_str(), strRequiredOSVersion.c_str());
     512                if ( res >= 0 && chComp == '>' )
     513                        *pfOutputting = true;
     514                else if ( res < 0 && chComp == '<' )
     515                        *pfOutputting = true;
     516                else
     517                    *pfOutputting = false;
     518            }
     519        }
     520        else
     521            *pfOutputting = false;//initially is set to "false"
     522    }
    625523    else
    626524        return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown conditional placeholder '%.*s'"),
  • trunk/src/VBox/Runtime/common/crypto/key-file.cpp

    r85121 r86648  
    106106    { g_aWords_PublicKey,     RT_ELEMENTS(g_aWords_PublicKey) },
    107107    { g_aWords_RsaPrivateKey, RT_ELEMENTS(g_aWords_RsaPrivateKey) },
     108    { g_aWords_EncryptedPrivateKey, RT_ELEMENTS(g_aWords_EncryptedPrivateKey) },
    108109    { g_aWords_PrivateKey,    RT_ELEMENTS(g_aWords_PrivateKey) },
    109110};
  • trunk/src/VBox/Runtime/generic/http-curl.cpp

    r86448 r86648  
    404404
    405405                *phHttp = (RTHTTP)pThis;
    406 
     406#if 0 // XXX: uwe
     407                {
     408                const char *verbose = getenv("CURL_VERBOSE");
     409                if (verbose != NULL && *verbose != '0')
     410                  curl_easy_setopt(pThis->pCurl, CURLOPT_VERBOSE, 1L);
     411                }
     412#endif
    407413                return VINF_SUCCESS;
    408414            }
     
    440446    pThis->rcOutput                 = VINF_SUCCESS;
    441447
    442     /* Tell the proxy configuration code to reapply settings even if they
    443        didn't change as cURL has forgotten them: */
    444     pThis->fReapplyProxyInfo        = true;
     448#if 0 // XXX: uwe
     449    {
     450    const char *verbose = getenv("CURL_VERBOSE");
     451    if (verbose != NULL && *verbose != '0')
     452      curl_easy_setopt(pThis->pCurl, CURLOPT_VERBOSE, 1L);
     453    }
     454#endif
    445455
    446456    return VINF_SUCCESS;
     
    26362646                pThis->fDeleteCaFile = true;
    26372647                pThis->pszCaFile = pszCaFile;
     2648
     2649//              RTPrintf("pszCaFile=\"%s\"\n", pszCaFile); // XXX: uwe
     2650
    26382651                return VINF_SUCCESS;
    26392652            }
  • trunk/src/VBox/ValidationKit/tests/api/tdAppliance1.py

    r82968 r86648  
    6161        """
    6262        fRc = True;
     63
     64        if not self.oTstDrv.importVBoxApi():
     65            return False
    6366
    6467        # Import a set of simple OVAs.
  • trunk/src/VBox/ValidationKit/tests/api/tdMoveVm1.py

    r86505 r86648  
    145145        fRc = True
    146146        try:
    147 
    148             ## @todo r=bird: Too much unncessary crap inside try clause.  Only oVM.moveTo needs to be here.
    149             ##               Though, you could make an argument for oVM.name too, perhaps.
    150 
    151147            # move machine
    152148            reporter.log('Moving machine "%s" to the "%s"' % (oVM.name, sLocation))
     
    236232
    237233                reporter.log('####### Reference locations: #######')
    238                 for eachItem in aActuals:
     234                for eachItem in aReferences:
    239235                    reporter.log(' "%s"' % (eachItem))
    240236
  • trunk/src/libs/curl-7.64.0/lib/sendf.c

    r85671 r86648  
    828828    case CURLINFO_HEADER_OUT:
    829829    case CURLINFO_HEADER_IN:
     830    case CURLINFO_DATA_IN:      /* XXX: uwe */
     831    case CURLINFO_DATA_OUT:     /* XXX: uwe */
    830832      fwrite(s_infotype[type], 2, 1, data->set.err);
    831833      fwrite(ptr, size, 1, data->set.err);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette