Changeset 94752 in vbox for trunk/src/VBox/Main/src-server/UnattendedInstaller.cpp
- Timestamp:
- Apr 28, 2022 10:08:31 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/UnattendedInstaller.cpp
r94751 r94752 995 995 RTVFS hVfsOrgIso, bool fOverwrite) 996 996 { 997 /* On Debian Live ISOs (at least from 9 to 11) the there is only menu.cfg. */ 998 RTCString strMenuConfigFileName("/isolinux/txt.cfg"); 999 if ( !hlpVfsFileExists(hVfsOrgIso, strMenuConfigFileName.c_str()) 1000 && hlpVfsFileExists(hVfsOrgIso, "/isolinux/menu.cfg")) 1001 strMenuConfigFileName = "/isolinux/menu.cfg"; 1002 1003 /* Ubuntus 21.10+ are UEFI only. No isolinux directory. We modify grub.cfg. */ 1004 if ( !hlpVfsFileExists(hVfsOrgIso, strMenuConfigFileName.c_str()) 1005 && hlpVfsFileExists(hVfsOrgIso, "/boot/grub/grub.cfg")) 1006 strMenuConfigFileName = "/boot/grub/grub.cfg"; 997 /* 998 * Figure out the name of the menu config file that we have to edit. 999 */ 1000 bool fMenuConfigIsGrub = false; 1001 const char *pszMenuConfigFilename = "/isolinux/txt.cfg"; 1002 if (!hlpVfsFileExists(hVfsOrgIso, pszMenuConfigFilename)) 1003 { 1004 /* On Debian Live ISOs (at least from 9 to 11) the there is only menu.cfg. */ 1005 if (hlpVfsFileExists(hVfsOrgIso, "/isolinux/menu.cfg")) 1006 pszMenuConfigFilename = "/isolinux/menu.cfg"; 1007 1008 /* Ubuntus 21.10+ are UEFI only. No isolinux directory. We modify grub.cfg. */ 1009 else if (hlpVfsFileExists(hVfsOrgIso, "/boot/grub/grub.cfg")) 1010 { 1011 pszMenuConfigFilename = "/boot/grub/grub.cfg"; 1012 fMenuConfigIsGrub = true; 1013 } 1014 } 1007 1015 1008 1016 /* Check for existence of isolinux.cfg since UEFI-only ISOs do not have this file. */ 1009 bool fIsoLinuxCfgExists = hlpVfsFileExists(hVfsOrgIso, "isolinux/isolinux.cfg"); 1017 bool const fIsoLinuxCfgExists = hlpVfsFileExists(hVfsOrgIso, "isolinux/isolinux.cfg"); 1018 Assert(!fIsoLinuxCfgExists || !fMenuConfigIsGrub); /** @todo r=bird: Perhaps prefix the hlpVfsFileExists call with 'fIsoLinuxCfgExists &&' above ? */ 1019 1010 1020 /* 1011 1021 * VISO bits and filenames. … … 1037 1047 1038 1048 /* Replace menu configuration file as well. */ 1039 rVecArgs.append().assign( strMenuConfigFileName).append("=:must-remove:");1049 rVecArgs.append().assign(pszMenuConfigFilename).append("=:must-remove:"); 1040 1050 strTxtCfg = mpParent->i_getAuxiliaryBasePath(); 1041 if ( strMenuConfigFileName.compare("/boot/grub/grub.cfg", RTCString::CaseInsensitive) == 0)1051 if (fMenuConfigIsGrub) 1042 1052 strTxtCfg.append("grub.cfg"); 1043 1053 else 1044 1054 strTxtCfg.append("isolinux-.cfg"); 1045 rVecArgs.append().assign( strMenuConfigFileName).append("=").append(strTxtCfg);1055 rVecArgs.append().assign(pszMenuConfigFilename).append("=").append(strTxtCfg); 1046 1056 } 1047 1057 catch (std::bad_alloc &) … … 1058 1068 HRESULT hrc = loadAndParseFileFromIso(hVfsOrgIso, "/isolinux/isolinux.cfg", &Editor); 1059 1069 if (SUCCEEDED(hrc)) 1060 hrc = editIsoLinuxCfg(&Editor, RTPathFilename( strMenuConfigFileName.c_str()));1070 hrc = editIsoLinuxCfg(&Editor, RTPathFilename(pszMenuConfigFilename)); 1061 1071 if (SUCCEEDED(hrc)) 1062 1072 { … … 1084 1094 { 1085 1095 GeneralTextScript Editor(mpParent); 1086 HRESULT hrc = loadAndParseFileFromIso(hVfsOrgIso, strMenuConfigFileName.c_str(), &Editor);1096 HRESULT hrc = loadAndParseFileFromIso(hVfsOrgIso, pszMenuConfigFilename, &Editor); 1087 1097 if (SUCCEEDED(hrc)) 1088 1098 { 1089 if ( strMenuConfigFileName.compare("/boot/grub/grub.cfg", RTCString::CaseInsensitive) == 0)1099 if (fMenuConfigIsGrub) 1090 1100 hrc = editDebianGrubCfg(&Editor); 1091 1101 else 1092 1102 hrc = editDebianMenuCfg(&Editor); 1093 }1094 if (SUCCEEDED(hrc))1095 {1096 hrc = Editor.save(strTxtCfg, fOverwrite);1097 1103 if (SUCCEEDED(hrc)) 1098 1104 { 1099 try 1105 hrc = Editor.save(strTxtCfg, fOverwrite); 1106 if (SUCCEEDED(hrc)) 1100 1107 { 1101 rVecFiles.append(strTxtCfg); 1102 } 1103 catch (std::bad_alloc &) 1104 { 1105 RTFileDelete(strTxtCfg.c_str()); 1106 hrc = E_OUTOFMEMORY; 1108 try 1109 { 1110 rVecFiles.append(strTxtCfg); 1111 } 1112 catch (std::bad_alloc &) 1113 { 1114 RTFileDelete(strTxtCfg.c_str()); 1115 hrc = E_OUTOFMEMORY; 1116 } 1107 1117 } 1108 1118 }
Note:
See TracChangeset
for help on using the changeset viewer.