Skip to content

Commit

Permalink
fix inverted logic for pmbr flag causing not working uefi boot
Browse files Browse the repository at this point in the history
fix inverted logic for pmbr flag causing not working uefi boot
  • Loading branch information
jreidinger committed Apr 6, 2016
1 parent 18a1119 commit 8d8f843
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/lib/bootloader/grub2.rb
Expand Up @@ -72,9 +72,9 @@ def propose
super

stage1.propose
# for GPT remove protective MBR flag otherwise some systems won't
# boot, safer option for legacy booting
self.pmbr_action = :remove if Yast::BootStorage.gpt_boot_disk?
# for GPT add protective MBR flag otherwise some systems won't
# boot, safer option for legacy booting (bnc#872054)
self.pmbr_action = :add if Yast::BootStorage.gpt_boot_disk?
device_map.propose if Yast::Arch.x86_64 || Yast::Arch.i386
end

Expand Down
4 changes: 2 additions & 2 deletions src/lib/bootloader/grub2efi.rb
Expand Up @@ -52,8 +52,8 @@ def write
def propose
super

# for UEFI always set PMBR flag on disk (bnc#872054)
self.pmbr_action = :add
# for UEFI always remove PMBR flag on disk (bnc#872054)
self.pmbr_action = :remove

@secure_boot = true
end
Expand Down
4 changes: 2 additions & 2 deletions test/grub2_efi_test.rb
Expand Up @@ -63,10 +63,10 @@
allow(Yast::BootStorage).to receive(:detect_disks)
end

it "proposes to add pmbr flag for disk" do
it "proposes to remove pmbr flag for disk" do
subject.propose

expect(subject.pmbr_action).to eq :add
expect(subject.pmbr_action).to eq :remove
end

it "proposes to use secure boot" do
Expand Down
4 changes: 2 additions & 2 deletions test/grub2_test.rb
Expand Up @@ -125,12 +125,12 @@
subject.propose
end

it "propose to remove pmbr flag if boot disk is with gpt label" do
it "propose to add pmbr flag if boot disk is with gpt label" do
allow(Yast::BootStorage).to receive(:gpt_boot_disk?).and_return(true)

subject.propose

expect(subject.pmbr_action).to eq :remove
expect(subject.pmbr_action).to eq :add
end

it "propose to do not change pmbr flag if boot disk is not with gpt label" do
Expand Down

0 comments on commit 8d8f843

Please sign in to comment.