mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-29 14:05:22 -04:00
[iso] fix GRUB boot for newer Arch and derivatives
* Arch recently added a "search --no-floppy --set=root --label <LABEL>" into their grub.cfg, which we didn't have provision for patching, which means that, as soon as the user changed the label or used an Arch derivative with a label that isn't compliant with FAT (e.g. Athena Linux), search, and therefore boot would fail. * Also alter the code so that we modify for more than one token if needed. * Closes #2086
This commit is contained in:
parent
4cfe1c9947
commit
165127d221
2 changed files with 17 additions and 14 deletions
21
src/iso.c
21
src/iso.c
|
@ -363,20 +363,23 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
|
|||
// Workaround for config files requiring an ISO label for kernel append that may be
|
||||
// different from our USB label. Oh, and these labels must have spaces converted to \x20.
|
||||
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
|
||||
//'linux' but '$linux'... and we have to add a workaround for that.
|
||||
// Finally, newer Arch and derivatives added an extra "search --label ..." command
|
||||
// in GRUB which we need to cater for in supplement to the kernel line.
|
||||
|
||||
static const char* grub_token[] = { "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) {
|
||||
// Older versions of GRUB EFI used "linuxefi", newer just use "linux"
|
||||
if ((replace_in_token_data(src, "linux", iso_label, usb_label, TRUE) != NULL) ||
|
||||
(replace_in_token_data(src, "linuxefi", iso_label, usb_label, TRUE) != NULL) ||
|
||||
// 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 'linux' but '$linux'... and we have to add a workaround for that.
|
||||
(replace_in_token_data(src, "$linux", iso_label, usb_label, TRUE) != NULL)) {
|
||||
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);
|
||||
modified = TRUE;
|
||||
}
|
||||
} 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue