Skip to content

Commit

Permalink
Merge pull request #341 from yast/pmbr_fix
Browse files Browse the repository at this point in the history
Pmbr fix
  • Loading branch information
jreidinger committed May 27, 2016
2 parents 0705b69 + b868f20 commit 3fd0ff2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
6 changes: 6 additions & 0 deletions package/yast2-bootloader.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri May 27 12:13:54 UTC 2016 - jreidinger@suse.com

- use proper device to setup pmbr for grub2efi (bnc#981997)
- 3.1.190

-------------------------------------------------------------------
Wed May 25 11:59:53 UTC 2016 - jreidinger@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-bootloader.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-bootloader
Version: 3.1.189
Version: 3.1.190
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
6 changes: 5 additions & 1 deletion src/lib/bootloader/grub2efi.rb
Expand Up @@ -4,6 +4,7 @@
require "bootloader/grub2base"
require "bootloader/grub_install"
require "bootloader/sysconfig"
require "bootloader/stage1_device"

Yast.import "Arch"

Expand Down Expand Up @@ -39,7 +40,10 @@ def write
efi_partition ||= Yast::Storage.GetEntryForMountpoint("/")["device"]
efi_disk = Yast::Storage.GetDiskPartition(efi_partition)["disk"]

pmbr_setup(efi_disk)
# get underlaying disk as it have to be set there and not on virtual one (bnc#981977)
device = ::Bootloader::Stage1Device.new(efi_disk)

pmbr_setup(*device.real_devices)
end

@grub_install.execute(secure_boot: @secure_boot)
Expand Down
10 changes: 5 additions & 5 deletions test/grub2_efi_test.rb
Expand Up @@ -23,14 +23,14 @@
end

describe "write" do
it "setups protective mbr to disk containing /boot/efi" do
it "setups protective mbr to real disks containing /boot/efi" do
subject.pmbr_action = :add
allow(Yast::Storage).to receive(:GetEntryForMountpoint)
.with("/boot/efi").and_return("device" => "/dev/sda1")
allow(Yast::Storage).to receive(:GetDiskPartition)
.with("/dev/sda1").and_return("disk" => "/dev/sda")
.with("/boot/efi").and_return("device" => "/dev/md1")
allow(Bootloader::Stage1Device).to receive(:new)
.and_return(double(real_devices: ["/dev/sda", "/dev/sdb"]))

expect(subject).to receive(:pmbr_setup).with("/dev/sda")
expect(subject).to receive(:pmbr_setup).with("/dev/sda", "/dev/sdb")

subject.write
end
Expand Down

0 comments on commit 3fd0ff2

Please sign in to comment.