Changeset 96721 in vbox
- Timestamp:
- Sep 13, 2022 2:12:23 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 153606
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r96706 r96721 1486 1486 } 1487 1487 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 */ 1497 static 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 1488 1509 /** 1489 1510 * Detect Linux distro ISOs. … … 1553 1574 try { mStrDetectedOSVersion = RTStrStrip(pBuf->sz); } 1554 1575 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 } 1555 1583 } 1556 1584 } … … 1685 1713 } 1686 1714 } 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 } 1687 1721 } 1688 1722 else … … 1694 1728 1695 1729 /* 1696 * Ubuntu has a README.diskdefin s 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). 1697 1731 * Example content: 1698 1732 * #define DISKNAME Ubuntu 4.10 "Warty Warthog" - Preview amd64 Binary-1 … … 1788 1822 try { mStrDetectedOSVersion = RTStrStripL(pszVersion); } 1789 1823 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 } 1790 1831 } 1791 1832 else … … 1871 1912 try { mStrDetectedOSVersion = RTStrStripL(pszVersion); } 1872 1913 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 } 1873 1921 } 1874 1922 else … … 3772 3820 return S_OK; 3773 3821 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 } 3778 3832 3779 3833 /* 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.