Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New flag in the product description file: #694

Merged
merged 5 commits into from
Feb 23, 2024
Merged
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: 8 additions & 0 deletions package/yast2-bootloader.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 20 07:42:45 UTC 2024 - Stefan Schubert <schubi@suse.com>

- Proposal: Trying to take the bootloader which has been defined in
the product description file (entry globals/prefered_bootloader)
(jsc#PED-1906)
- 5.0.5

-------------------------------------------------------------------
Thu Jan 25 11:18:12 UTC 2024 - Knut Anderssen <kanderssen@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-bootloader.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-bootloader
Version: 5.0.4
Version: 5.0.5
Release: 0
Summary: YaST2 - Bootloader Configuration
License: GPL-2.0-or-later
Expand Down
28 changes: 16 additions & 12 deletions src/lib/bootloader/bootloader_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ def supported_names
if Yast::Mode.config
# default means bootloader use what it think is the best
result = BootloaderFactory::SUPPORTED_BOOTLOADERS.clone
if Yast::ProductFeatures.GetBooleanFeature("globals", "enable_systemd_boot") &&
Yast::Arch.x86_64 # only x86_64 is supported
result << SYSTEMDBOOT
end
result << SYSTEMDBOOT if use_systemd_boot?
result << DEFAULT_KEYWORD
return result
end
Expand All @@ -75,10 +72,7 @@ def supported_names
# grub2 everywhere except aarch64 or riscv64
ret << "grub2" unless Systeminfo.efi_mandatory?
ret << "grub2-efi" if Systeminfo.efi_supported?
if Yast::ProductFeatures.GetBooleanFeature("globals", "enable_systemd_boot") &&
Yast::Arch.x86_64 # only x86_64 is supported
ret << SYSTEMDBOOT
end
ret << SYSTEMDBOOT if use_systemd_boot?
ret << "none"
# avoid double entry for selected one
ret.uniq
Expand Down Expand Up @@ -109,14 +103,24 @@ def bootloader_by_name(name)

private

def boot_efi?
Systeminfo.efi?
def use_systemd_boot?
Yast::ProductFeatures.GetBooleanFeature("globals", "enable_systemd_boot") &&
(Yast::Arch.x86_64 || Yast::Arch.aarch64) # only these architectures are supported.
end

def grub2_efi_installable?
Systeminfo.efi_mandatory? ||
((Yast::Arch.x86_64 || Yast::Arch.i386) && Systeminfo.efi?)
end

def proposed_name
return "grub2-efi" if Systeminfo.efi_mandatory?
prefered_bootloader = Yast::ProductFeatures.GetStringFeature("globals",
"prefered_bootloader")
if supported_names.include?(prefered_bootloader) && prefered_bootloader != "grub2-efi"
return prefered_bootloader
end

return "grub2-efi" if (Yast::Arch.x86_64 || Yast::Arch.i386) && boot_efi?
return "grub2-efi" if grub2_efi_installable?

"grub2" # grub2 works(c) everywhere
end
Expand Down
4 changes: 2 additions & 2 deletions test/bootloader_factory_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
before do
allow(Yast::ProductFeatures).to receive(:GetBooleanFeature).with("globals", "enable_systemd_boot").and_return(true)
end
it "does not include systemd-boot and grub2 in the list" do
expect(Bootloader::BootloaderFactory.supported_names).to eq ["grub2-efi", "none"]
it "does not include grub2 in the list" do
expect(Bootloader::BootloaderFactory.supported_names).to eq ["grub2-efi", "systemd-boot", "none"]
end
end
context "product does not support systemd-boot" do
Expand Down
Loading