VirtualBox

Changeset 96721 in vbox


Ignore:
Timestamp:
Sep 13, 2022 2:12:23 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
153606
Message:

Unattended: bugref:9781. Using the first part of the read disk name string as OS flavor and black listing newer lubuntus.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/UnattendedImpl.cpp

    r96706 r96721  
    14861486}
    14871487
     1488
     1489/**
     1490 * Helps detecting linux distro flavor by finding substring position of non numerical
     1491 * part of the disk name.
     1492 *
     1493 * @returns true if detected, false if not.
     1494 * @param   pszDiskName          Name of the disk as it is read from .disk/info or README.diskdefines file.
     1495 * @param   cchVersionPosition   String position where first numerical character is found. We use substring upto this position as OS flavor
     1496 */
     1497static bool detectLinuxDistroFlavor(const char *pszDiskName, size_t *cchVersionPosition)
     1498{
     1499    if (!pszDiskName || !cchVersionPosition)
     1500        return false;
     1501    while (*pszDiskName != '\0' && !RT_C_IS_DIGIT(*pszDiskName))
     1502    {
     1503        ++pszDiskName;
     1504        ++(*cchVersionPosition);
     1505    }
     1506    return true;
     1507}
     1508
    14881509/**
    14891510 * Detect Linux distro ISOs.
     
    15531574                        try { mStrDetectedOSVersion = RTStrStrip(pBuf->sz); }
    15541575                        catch (std::bad_alloc &) { return E_OUTOFMEMORY; }
     1576
     1577                        size_t cchVersionPosition = 0;
     1578                        if (detectLinuxDistroFlavor(pBuf->sz, &cchVersionPosition))
     1579                        {
     1580                            try { mStrDetectedOSFlavor = Utf8Str(pBuf->sz, cchVersionPosition); }
     1581                            catch (std::bad_alloc &) { return E_OUTOFMEMORY; }
     1582                        }
    15551583                    }
    15561584                }
     
    16851713                }
    16861714            }
     1715            size_t cchVersionPosition = 0;
     1716            if (detectLinuxDistroFlavor(apszLines[1], &cchVersionPosition))
     1717            {
     1718                try { mStrDetectedOSFlavor = Utf8Str(apszLines[1], cchVersionPosition); }
     1719                catch (std::bad_alloc &) { return E_OUTOFMEMORY; }
     1720            }
    16871721        }
    16881722        else
     
    16941728
    16951729    /*
    1696      * Ubuntu has a README.diskdefins file on their ISO (already on 4.10 / warty warthog).
     1730     * Ubuntu has a README.diskdefines file on their ISO (already on 4.10 / warty warthog).
    16971731     * Example content:
    16981732     *  #define DISKNAME  Ubuntu 4.10 "Warty Warthog" - Preview amd64 Binary-1
     
    17881822                    try { mStrDetectedOSVersion = RTStrStripL(pszVersion); }
    17891823                    catch (std::bad_alloc &) { return E_OUTOFMEMORY; }
     1824
     1825                    size_t cchVersionPosition = 0;
     1826                    if (detectLinuxDistroFlavor(pszDiskName, &cchVersionPosition))
     1827                    {
     1828                        try { mStrDetectedOSFlavor = Utf8Str(pszDiskName, cchVersionPosition); }
     1829                        catch (std::bad_alloc &) { return E_OUTOFMEMORY; }
     1830                    }
    17901831                }
    17911832                else
     
    18711912                try { mStrDetectedOSVersion = RTStrStripL(pszVersion); }
    18721913                catch (std::bad_alloc &) { return E_OUTOFMEMORY; }
     1914
     1915                size_t cchVersionPosition = 0;
     1916                if (detectLinuxDistroFlavor(pszDiskName, &cchVersionPosition))
     1917                {
     1918                    try { mStrDetectedOSFlavor = Utf8Str(pszDiskName, cchVersionPosition); }
     1919                    catch (std::bad_alloc &) { return E_OUTOFMEMORY; }
     1920                }
    18731921            }
    18741922            else
     
    37723820        return S_OK;
    37733821
    3774     /* We cannot install Ubuntus older than 11.04. */
    3775     if (   enmOsTypeMasked == VBOXOSTYPE_Ubuntu
    3776         && RTStrVersionCompare(mStrDetectedOSVersion.c_str(), "11.04") < 0)
    3777         return S_OK;
     3822    if (enmOsTypeMasked == VBOXOSTYPE_Ubuntu)
     3823    {
     3824        /* We cannot install Ubuntus older than 11.04. */
     3825        if (RTStrVersionCompare(mStrDetectedOSVersion.c_str(), "11.04") < 0)
     3826            return S_OK;
     3827        /* Lubuntu, starting with 20.04, has switched to calamares, which cannot be automated. */
     3828        if (   RTStrIStr(mStrDetectedOSFlavor.c_str(), "lubuntu")
     3829            && RTStrVersionCompare(mStrDetectedOSVersion.c_str(), "20.04") > 0)
     3830            return S_OK;
     3831    }
    37783832
    37793833    /* Earlier than OL 6.4 cannot be installed. OL 6.x fails with unsupported hardware error (CPU family). */
Note: See TracChangeset for help on using the changeset viewer.

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