Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Dec 19, 2024
1 parent 8caed9a commit 712d716
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
20 changes: 6 additions & 14 deletions src/lib/y2storage/boot_requirements_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
require "yast"
require "y2storage/boot_requirements_strategies"
require "y2storage/storage_manager"
require "y2storage/storage_env"

module Y2Storage
#
Expand Down Expand Up @@ -127,8 +128,6 @@ def strategy_class
BootRequirementsStrategies::NfsRoot
elsif raspberry_pi?
BootRequirementsStrategies::Raspi
elsif bls?
BootRequirementsStrategies::BLS
else
arch_strategy_class
end
Expand All @@ -139,7 +138,11 @@ def strategy_class
# @return [BootRequirementsStrategies::Base]
def arch_strategy_class
if arch.efiboot?
BootRequirementsStrategies::UEFI
if StorageEnv.instance.no_bls_bootloader
BootRequirementsStrategies::UEFI
else
BootRequirementsStrategies::BLS
end
elsif arch.s390?
BootRequirementsStrategies::ZIPL
elsif arch.ppc?
Expand All @@ -150,17 +153,6 @@ def arch_strategy_class
end
end

# Whether BLS boot will be used for booting
#
# @return [Boolean]
def bls?
Yast.import "Linuxrc"

arch.efiboot? &&
(Yast::Linuxrc.InstallInf("NO_BLS_BOOT").nil? ||
Yast::Linuxrc.InstallInf("NO_BLS_BOOT") != 1)
end

# Whether the root filesystem is NFS
#
# @return [Boolean]
Expand Down
4 changes: 2 additions & 2 deletions src/lib/y2storage/boot_requirements_strategies/bls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def initialize(*args)
def efi_volume
if @efi_volume.nil?
@efi_volume = volume_specification_for("/boot/efi")
# BLS needs 1GiB for boot at least
# BLS suggests 1GiB for boot partition
# https://uapi-group.org/specifications/specs/boot_loader_specification/
@efi_volume.min_size = DiskSize.GiB(1)
@efi_volume.min_size = DiskSize.MiB(512)
@efi_volume.desired_size = DiskSize.GiB(1)
@efi_volume.max_size = DiskSize.GiB(1)
end
Expand Down
11 changes: 10 additions & 1 deletion src/lib/y2storage/storage_env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ class StorageEnv

ENV_REUSE_LVM = "YAST_REUSE_LVM".freeze

ENV_NO_BLS_BOOT = "YAST_NO_BLS_BOOT".freeze

private_constant :ENV_MULTIPATH, :ENV_BIOS_RAID, :ENV_ACTIVATE_LUKS
private_constant :ENV_LIBSTORAGE_IGNORE_PROBE_ERRORS
private_constant :ENV_REUSE_LVM
private_constant :ENV_REUSE_LVM, :ENV_NO_BLS_BOOT

def initialize
reset_cache
Expand Down Expand Up @@ -93,6 +95,13 @@ def requested_lvm_reuse
env_str_to_bool(value)
end

# Whether YaST should not use bls bootloaders
#
# @return [Boolean]
def no_bls_bootloader
active?(ENV_NO_BLS_BOOT)
end

# Whether errors during libstorage probing should be ignored.
#
# See bsc#1177332:
Expand Down
4 changes: 2 additions & 2 deletions test/support/proposed_partitions_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@
expect(efi_part.mkfs_options).to include "-F32"
end

it "requires it to be at least 1 GiB" do
expect(efi_part.min).to eq 1.GiB
it "requires it to be at least 512 MiB" do
expect(efi_part.min).to eq 512.MiB
end

it "requires it to be at most 1 GiB (enough space for all BLS entries)" do
Expand Down
4 changes: 2 additions & 2 deletions test/y2storage/boot_requirements_checker_x86_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,15 @@

context "and BLS bootloader as default" do
before do
allow(Yast::Linuxrc).to receive(:InstallInf).with("NO_BLS_BOOT").and_return(0)
allow(Y2Storage::StorageEnv.instance.no_bls_bootloader).to be false
end

include_examples "EFI partition for BLS bootloaders"
end

context "and no BLS bootloader as default" do
before do
allow(Yast::Linuxrc).to receive(:InstallInf).with("NO_BLS_BOOT").and_return(1)
allow(Y2Storage::StorageEnv.instance.no_bls_bootloader).to be true
end

include_examples "flexible size EFI partition"
Expand Down

0 comments on commit 712d716

Please sign in to comment.