Skip to content

Commit

Permalink
do not skip grub2 install if runned with empty devices (bnc#980250)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed May 17, 2016
1 parent 5bc79cd commit 0b73b3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/lib/bootloader/grub_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ def execute(devices: nil, secure_boot: false, trusted_boot: false)
cmd << "--no-nvram" << "--removable"
end

if devices
if devices && !devices.empty?
devices.each do |dev|
Yast::Execute.on_target(cmd + [dev])
end
else
Yast::Execute.on_target(cmd)
# s390 and efi can install grub2 without device, otherwise user
# intentionally do not want grub2 installed by yast2
Yast::Execute.on_target(cmd) if Yast::Arch.s390 || @efi
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/grub_install_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def expect_grub2_install(target, device: nil, removable: false)
stub_efivars
expect_grub2_install("arm64-efi")

subject.execute
subject.execute(devices: [])
end

it "raise exception for other architectures" do
Expand Down Expand Up @@ -145,9 +145,9 @@ def expect_grub2_install(target, device: nil, removable: false)
stub_arch("s390_64")
stub_efivars

expect_grub2_install("s390x-emu", device: "/dev/dasda1")
expect_grub2_install("s390x-emu")

subject.execute(devices: ["/dev/dasda1"])
subject.execute(devices: [])
end

it "raise exception on aarch64" do
Expand Down

0 comments on commit 0b73b3c

Please sign in to comment.