1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[iso] fix Fedora UEFI support

* One of the ANNOYING distros that relies on an extended label to
  find the install media and is now doing that for Grub/EFI.
* Closes #547
This commit is contained in:
Pete Batard 2015-08-13 23:31:12 +01:00
parent 29588ac684
commit ab6f0ef0bb
3 changed files with 35 additions and 28 deletions

View file

@ -153,11 +153,11 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons
} }
// Check for the Grub config file // Check for the Grub config file
if ((safe_stricmp(psz_dirname, grub_dirname) == 0) && (safe_stricmp(psz_basename, grub_cfg) == 0)) { if (scan_only) {
if (scan_only) if ((safe_stricmp(psz_dirname, grub_dirname) == 0) && (safe_stricmp(psz_basename, grub_cfg) == 0))
iso_report.has_grub2 = TRUE; iso_report.has_grub2 = TRUE;
else } else if (safe_stricmp(psz_basename, grub_cfg) == 0) {
props->is_grub_cfg = TRUE; props->is_grub_cfg = TRUE;
} }
if (scan_only) { if (scan_only) {
@ -237,6 +237,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons
return FALSE; return FALSE;
} }
// Apply various workarounds to Linux config files
static void fix_config(const char* psz_fullpath, const char* psz_path, const char* psz_basename, EXTRACT_PROPS* props) static void fix_config(const char* psz_fullpath, const char* psz_path, const char* psz_basename, EXTRACT_PROPS* props)
{ {
size_t i, nul_pos; size_t i, nul_pos;
@ -249,26 +250,31 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
for (i=0; i<nul_pos; i++) for (i=0; i<nul_pos; i++)
if (src[i] == '/') src[i] = '\\'; if (src[i] == '/') src[i] = '\\';
if (props->is_syslinux_cfg) { // Workaround for config files requiring an ISO label for kernel append that may be
// Workaround for isolinux config files requiring an ISO label for kernel // different from our USB label. Oh, and these labels must have spaces converted to \x20.
// append that may be different from our USB label. Oh, and these labels if ((props->is_syslinux_cfg) || (props->is_grub_cfg)) {
// must have spaces converted to \x20.
iso_label = replace_char(iso_report.label, ' ', "\\x20"); iso_label = replace_char(iso_report.label, ' ', "\\x20");
usb_label = replace_char(iso_report.usb_label, ' ', "\\x20"); usb_label = replace_char(iso_report.usb_label, ' ', "\\x20");
if ((iso_label != NULL) && (usb_label != NULL)) { if ((iso_label != NULL) && (usb_label != NULL)) {
if (replace_in_token_data(src, "append", iso_label, usb_label, TRUE) != NULL) if (replace_in_token_data(src, (props->is_syslinux_cfg) ? "append" : "linuxefi", iso_label, usb_label, TRUE) != NULL)
uprintf(" Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); uprintf(" Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label);
// Fix dual BIOS + EFI support for tails and other ISOs
if ( (safe_stricmp(psz_path, efi_dirname) == 0) && (safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) &&
(!iso_report.has_efi_syslinux) && (dst = safe_strdup(src)) ) {
dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's';
CopyFileA(src, dst, TRUE);
uprintf("Duplicated %s to %s\n", src, dst);
free(dst);
}
} }
} else if (props->is_grub_cfg) { safe_free(iso_label);
// Workaround for FreeNAS safe_free(usb_label);
}
// Fix dual BIOS + EFI support for tails and other ISOs
if ( (props->is_syslinux_cfg) && (safe_stricmp(psz_path, efi_dirname) == 0) &&
(safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) &&
(!iso_report.has_efi_syslinux) && (dst = safe_strdup(src)) ) {
dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's';
CopyFileA(src, dst, TRUE);
uprintf("Duplicated %s to %s\n", src, dst);
free(dst);
}
// Workaround for FreeNAS
if (props->is_grub_cfg) {
iso_label = malloc(MAX_PATH); iso_label = malloc(MAX_PATH);
usb_label = malloc(MAX_PATH); usb_label = malloc(MAX_PATH);
if ((iso_label != NULL) && (usb_label != NULL)) { if ((iso_label != NULL) && (usb_label != NULL)) {
@ -277,9 +283,10 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
if (replace_in_token_data(src, "set", iso_label, usb_label, TRUE) != NULL) if (replace_in_token_data(src, "set", iso_label, usb_label, TRUE) != NULL)
uprintf(" Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); uprintf(" Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label);
} }
safe_free(iso_label);
safe_free(usb_label);
} }
safe_free(iso_label);
safe_free(usb_label);
free(src); free(src);
} }

View file

@ -1145,8 +1145,8 @@ char* replace_in_token_data(const char* filename, const char* token, const char*
break; break;
} }
fseek(fd_in, 0, SEEK_SET); fseek(fd_in, 0, SEEK_SET);
duprintf("'%s' was detected as %s\n", filename, // duprintf("'%s' was detected as %s\n", filename,
(mode==0)?"ANSI/UTF8 (no BOM)":((mode==1)?"UTF8 (with BOM)":"UTF16 (with BOM")); // (mode==0)?"ANSI/UTF8 (no BOM)":((mode==1)?"UTF8 (with BOM)":"UTF16 (with BOM"));
wtmpname = (wchar_t*)calloc(wcslen(wfilename)+2, sizeof(wchar_t)); wtmpname = (wchar_t*)calloc(wcslen(wfilename)+2, sizeof(wchar_t));

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.3.697" CAPTION "Rufus 2.3.698"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -298,8 +298,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,3,697,0 FILEVERSION 2,3,698,0
PRODUCTVERSION 2,3,697,0 PRODUCTVERSION 2,3,698,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -316,13 +316,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.3.697" VALUE "FileVersion", "2.3.698"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.3.697" VALUE "ProductVersion", "2.3.698"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"