From b969b7ec426781d79cfd6b2a52d7d63009e984a7 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Tue, 21 Feb 2023 19:57:27 +0000 Subject: [PATCH] [iso] add yet another exception for Red Hat derivatives * Fedora 37 netinst requires special handling and I don't have all day. * Closes #2179. * Also fix a small typo in Italian translations. Closes #2180. --- res/loc/po/it-IT.po | 4 ++-- res/loc/rufus.loc | 2 +- src/iso.c | 39 ++++++++++++++++++++++----------------- src/rufus.rc | 10 +++++----- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/res/loc/po/it-IT.po b/res/loc/po/it-IT.po index b421cda1..bc8c5b2f 100644 --- a/res/loc/po/it-IT.po +++ b/res/loc/po/it-IT.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: 3.22\n" "Report-Msgid-Bugs-To: pete@akeo.ie\n" "POT-Creation-Date: 2023-02-17 10:50+0100\n" -"PO-Revision-Date: 2023-02-17 17:34+0000\n" +"PO-Revision-Date: 2023-02-21 19:52+0000\n" "Last-Translator: \n" "Language-Team: \n" "Language: it_IT\n" @@ -713,7 +713,7 @@ msgid "" "If you are sure you want to cancel, click YES. Otherwise, click NO." msgstr "" "La cancellazione potrebbe lasciare il dispositivo in uno stato NON USABILE.\n" -"Sei sicuro di volerlo cancellare, seleziona 'SI'. Altrimenti, seleziona 'NO'." +"Se sei sicuro di volerlo cancellare, seleziona 'SI'. Altrimenti, seleziona 'NO'." #. • MSG_106 msgid "Please select folder" diff --git a/res/loc/rufus.loc b/res/loc/rufus.loc index 91f48061..0412ac80 100644 --- a/res/loc/rufus.loc +++ b/res/loc/rufus.loc @@ -6524,7 +6524,7 @@ t MSG_101 "Supporto WIM mancante" t MSG_102 "Il tuo sistema operativo non può estrarre file dall'archivio WIM. L'estrazione WIM è necessaria per creare una unità USB avviabile EFI Windows 7 e Windows Vista. Puoi correggere ciò installando una versione recente di 7-Zip.\nVuoi visitare la pagina web in cui scaricare di 7-zip?" t MSG_103 "Vuoi scaricare %s?" t MSG_104 "%s o successivo richiedono l'installazione del file '%s'.\nPoiché questo file è più grande di 100 KB, ed è sempre presente nell'immagine ISO di %s, il file non è incluso in Rufus.\n\nRufus può scaricare per te il file mancante:\n- Seleziona 'Sì' per collegarti a internet e scaricare il file\n- Seleziona 'No' se vuoi copiare manualmente questo file nell'unità più tardi\n\nNota: il file verrà scaricato nella cartella attuale e una volta che '%s' è stato scaricato, verrà riusato automaticamente." -t MSG_105 "La cancellazione potrebbe lasciare il dispositivo in uno stato NON USABILE.\nSei sicuro di volerlo cancellare, seleziona 'SI'. Altrimenti, seleziona 'NO'." +t MSG_105 "La cancellazione potrebbe lasciare il dispositivo in uno stato NON USABILE.\nSe sei sicuro di volerlo cancellare, seleziona 'SI'. Altrimenti, seleziona 'NO'." t MSG_106 "Seleziona la cartella" t MSG_107 "Tutti i file" t MSG_108 "Registro eventi Rufus" diff --git a/src/iso.c b/src/iso.c index bc228020..f7d9c4f6 100644 --- a/src/iso.c +++ b/src/iso.c @@ -365,32 +365,37 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha if ((props->is_cfg) || (props->is_conf)) { // Older versions of GRUB EFI used "linuxefi", newer just use "linux". // Also, in their great wisdom, the openSUSE maintainers added a 'set linux=linux' - // line to their grub.cfg, which means that their kernel option token is no longer + // line to their grub.cfg, which means that their kernel option cfg_token is no longer //'linux' but '$linux'... and we have to add a workaround for that. - // Finally, newer Arch and derivatives added an extra "search --label ..." command + // Then, newer Arch and derivatives added an extra "search --label ..." command // in their GRUB conf, which we need to cater for in supplement of the kernel line. - static const char* grub_token[] = { "linux", "linuxefi", "$linux", "search" }; + // Finally, we're just shoving the known isolinux/syslinux tokens in there to process + // all config files equally. + static const char* cfg_token[] = { "options", "append", "linux", "linuxefi", "$linux", "search" }; iso_label = replace_char(img_report.label, ' ', "\\x20"); usb_label = replace_char(img_report.usb_label, ' ', "\\x20"); if ((iso_label != NULL) && (usb_label != NULL)) { - if (props->is_grub_cfg) { - for (int i = 0; i < ARRAYSIZE(grub_token); i++) - if (replace_in_token_data(src, grub_token[i], iso_label, usb_label, TRUE) != NULL) - modified = TRUE; - if (modified) - uprintf(" Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label); - } else if (replace_in_token_data(src, (props->is_conf) ? "options" : "append", - iso_label, usb_label, TRUE) != NULL) { - uprintf(" Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label); - modified = TRUE; + for (int i = 0; i < ARRAYSIZE(cfg_token); i++) { + if (replace_in_token_data(src, cfg_token[i], iso_label, usb_label, TRUE) != NULL) + modified = TRUE; } + if (modified) + uprintf(" Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label); // Since version 8.2, and https://github.com/rhinstaller/anaconda/commit/a7661019546ec1d8b0935f9cb0f151015f2e1d95, // Red Hat derivatives have changed their CD-ROM detection policy which leads to the installation source // not being found. So we need to use 'inst.repo' instead of 'inst.stage2' in the kernel options. - if (img_report.rh8_derivative && (replace_in_token_data(src, props->is_grub_cfg ? - "linuxefi" : "append", "inst.stage2", "inst.repo", TRUE) != NULL)) { - uprintf(" Patched %s: '%s' ➔ '%s'\n", src, "inst.stage2", "inst.repo"); - modified = TRUE; + // *EXCEPT* this should not be done for netinst media such as Fedora 37 netinstall and trying to differentiate + // netinst from regular is a pain. So, because I don't have all day to fix the mess that Red-Hat created when + // they introduced a kernel option to decide where the source packages should be picked from we're just going + // to *hope* that users didn't rename their ISOs and check whether it contains 'netinst' or not. Oh well... + modified = FALSE; + if (img_report.rh8_derivative && (strstr(image_path, "netinst") == NULL)) { + for (int i = 0; i < ARRAYSIZE(cfg_token); i++) { + if (replace_in_token_data(src, cfg_token[i], "inst.stage2", "inst.repo", TRUE) != NULL) + modified = TRUE; + } + if (modified) + uprintf(" Patched %s: '%s' ➔ '%s'\n", src, "inst.stage2", "inst.repo"); } } safe_free(iso_label); diff --git a/src/rufus.rc b/src/rufus.rc index b0519682..809996b5 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.22.1975" +CAPTION "Rufus 3.22.1976" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,22,1975,0 - PRODUCTVERSION 3,22,1975,0 + FILEVERSION 3,22,1976,0 + PRODUCTVERSION 3,22,1976,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.22.1975" + VALUE "FileVersion", "3.22.1976" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.22.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.22.1975" + VALUE "ProductVersion", "3.22.1976" END END BLOCK "VarFileInfo"