VirtualBox

Ignore:
Timestamp:
Jan 4, 2022 1:41:47 AM (3 years ago)
Author:
vboxsync
Message:

IPRT/RTIsoMaker: Added an --name-setup-from-import option to better handle importing old ISOs without joliet present. We get into trouble when adding our files to the ISO in both primary iso and joliet space, since the guest might be inclined to show the joliet view (which is missing the files from the imported ISO).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/fs/isomakercmd.cpp

    r93115 r93118  
    100100    RTFSISOMAKERCMD_OPT_RANDOM_ORDER_VERIFICATION,
    101101    RTFSISOMAKERCMD_OPT_NAME_SETUP,
     102    RTFSISOMAKERCMD_OPT_NAME_SETUP_FROM_IMPORT,
    102103
    103104    RTFSISOMAKERCMD_OPT_ROCK_RIDGE,
     
    463464     */
    464465    { "--name-setup",                   RTFSISOMAKERCMD_OPT_NAME_SETUP,                     RTGETOPT_REQ_STRING  },
     466    { "--name-setup-from-import",       RTFSISOMAKERCMD_OPT_NAME_SETUP_FROM_IMPORT,         RTGETOPT_REQ_NOTHING },
    465467    { "--import-iso",                   RTFSISOMAKERCMD_OPT_IMPORT_ISO,                     RTGETOPT_REQ_STRING  },
    466468    { "--push-iso",                     RTFSISOMAKERCMD_OPT_PUSH_ISO,                       RTGETOPT_REQ_STRING  },
     
    14191421
    14201422/**
     1423 * Handles the --name-setup-from-import option.
     1424 *
     1425 * @returns IPRT status code.
     1426 * @param   pOpts               The ISO maker command instance.
     1427 */
     1428static int rtFsIsoMakerCmdOptNameSetupFromImport(PRTFSISOMAKERCMDOPTS pOpts)
     1429{
     1430    /*
     1431     * Figure out what's on the ISO.
     1432     */
     1433    uint32_t fNamespaces = RTFsIsoMakerGetPopulatedNamespaces(pOpts->hIsoMaker);
     1434    AssertReturn(fNamespaces != UINT32_MAX, VERR_INVALID_HANDLE);
     1435    if (fNamespaces != 0)
     1436    {
     1437        if (   (fNamespaces & RTFSISOMAKER_NAMESPACE_ISO_9660)
     1438            && RTFsIsoMakerGetRockRidgeLevel(pOpts->hIsoMaker) > 0)
     1439            fNamespaces |= RTFSISOMAKERCMDNAME_PRIMARY_ISO_ROCK_RIDGE;
     1440
     1441        if (   (fNamespaces & RTFSISOMAKER_NAMESPACE_JOLIET)
     1442            && RTFsIsoMakerGetJolietRockRidgeLevel(pOpts->hIsoMaker) > 0)
     1443            fNamespaces |= RTFSISOMAKERCMDNAME_JOLIET_ROCK_RIDGE;
     1444
     1445        /*
     1446         * The TRANS.TBL files cannot be disabled at present and the importer
     1447         * doesn't check whether they are there or not, so carry them on from
     1448         * the previous setup.
     1449         */
     1450        uint32_t fOld = 0;
     1451        uint32_t i    = pOpts->cNameSpecifiers;
     1452        while (i-- > 0)
     1453            fOld |= pOpts->afNameSpecifiers[0];
     1454        if (fNamespaces & RTFSISOMAKER_NAMESPACE_ISO_9660)
     1455            fNamespaces |= fOld & RTFSISOMAKERCMDNAME_PRIMARY_ISO_TRANS_TBL;
     1456        if (fNamespaces & RTFSISOMAKER_NAMESPACE_JOLIET)
     1457            fNamespaces |= fOld & RTFSISOMAKERCMDNAME_PRIMARY_ISO_TRANS_TBL;
     1458        if (fNamespaces & RTFSISOMAKER_NAMESPACE_UDF)
     1459            fNamespaces |= fOld & RTFSISOMAKERCMDNAME_UDF_TRANS_TBL;
     1460        if (fNamespaces & RTFSISOMAKER_NAMESPACE_HFS)
     1461            fNamespaces |= fOld & RTFSISOMAKERCMDNAME_HFS_TRANS_TBL;
     1462
     1463        /*
     1464         * Apply the new configuration.
     1465         */
     1466        pOpts->cNameSpecifiers     = 1;
     1467        pOpts->afNameSpecifiers[0] = fNamespaces;
     1468        pOpts->fDstNamespaces      = fNamespaces & RTFSISOMAKERCMDNAME_MAJOR_MASK;
     1469
     1470        char szTmp[128];
     1471        rtFsIsoMakerPrintf(pOpts, "info: --name-setup-from-import determined: --name-setup=%s\n",
     1472                           rtFsIsoMakerCmdNameSpecifiersToString(fNamespaces, szTmp, sizeof(szTmp)));
     1473        return VINF_SUCCESS;
     1474    }
     1475    return rtFsIsoMakerCmdErrorRc(pOpts, VERR_DRIVE_IS_EMPTY, "--name-setup-from-import used on an empty ISO");
     1476}
     1477
     1478
     1479/**
    14211480 * Checks if we should use the source stack or the regular file system for
    14221481 * opening a source.
     
    31873246                break;
    31883247
     3248            case RTFSISOMAKERCMD_OPT_NAME_SETUP_FROM_IMPORT:
     3249                rc = rtFsIsoMakerCmdOptNameSetupFromImport(pOpts);
     3250                break;
     3251
    31893252            case RTFSISOMAKERCMD_OPT_PUSH_ISO:
    31903253                rc = rtFsIsoMakerCmdOptPushIso(pOpts, ValueUnion.psz, "--push-iso", 0);
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