Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Fix restores on UEFI Fedora and Red Hat systems #768

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Core/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2385,9 +2385,13 @@ public class Main : GLib.Object{
sh += "echo '" + _("Updating GRUB menu...") + "' \n";

if (target_distro.dist_type == "redhat"){
sh += "%s grub2-mkconfig -o /boot/grub2/grub.cfg \n".printf(chroot);
if (target_distro.is_efi){
sh += "%s grub2-mkconfig -o /boot/efi/EFI/%s/grub.cfg \n".printf(chroot, target_distro.dist_id);
else{
sh += "%s grub2-mkconfig -o /boot/grub2/grub.cfg \n".printf(chroot);
}
Comment on lines +2388 to +2392

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/boot/grub2/grub.cfg is where it is for both EFI and non-EFI since Fedora 34 and RHEL/CentOS 9: https://fedoraproject.org/wiki/Changes/UnifyGrubConfig

Copy link
Contributor

@randallpittman randallpittman Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevertheless, RHEL8 and earlier are pretty long-lived. Preferably support those (understand if that has to be in my own fork though).

Copy link
Contributor

@randallpittman randallpittman Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also dist_id won't work for Redhat as the path uses "redhat" but dist_id will be "rhel"

}
if (target_distro.dist_type == "arch"){
else if (target_distro.dist_type == "arch"){
sh += "%s grub-mkconfig -o /boot/grub/grub.cfg \n".printf(chroot);
}
else{
Expand Down
5 changes: 5 additions & 0 deletions src/Utility/LinuxDistro.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public class LinuxDistro : GLib.Object{
public string description = "";
public string release = "";
public string codename = "";
public bool is_efi = true;

public LinuxDistro(){

dist_id = "";
description = "";
release = "";
codename = "";
is_efi = true;
}

public string full_name(){
Expand All @@ -64,6 +66,9 @@ public class LinuxDistro : GLib.Object{

LinuxDistro info = new LinuxDistro();

string efi_dir = root_path + "/sys/firmware/efi";
info.is_efi = File.parse_name(efi_dir).query_exists();

string dist_file = root_path + "/etc/lsb-release";
var f = File.new_for_path(dist_file);
if (f.query_exists()){
Expand Down