diff --git a/package/yast2-bootloader.changes b/package/yast2-bootloader.changes index 0829dc461..2a0c8535f 100644 --- a/package/yast2-bootloader.changes +++ b/package/yast2-bootloader.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jul 20 15:12:13 CEST 2018 - schubi@suse.de + +- Update: Fixed crash while reading grub settings from installed + system (bsc#1094031). +- 4.1.6 + ------------------------------------------------------------------- Thu Jun 28 15:36:26 CEST 2018 - schubi@suse.de diff --git a/package/yast2-bootloader.spec b/package/yast2-bootloader.spec index fc43deff7..4fcde3176 100644 --- a/package/yast2-bootloader.spec +++ b/package/yast2-bootloader.spec @@ -17,7 +17,7 @@ Name: yast2-bootloader -Version: 4.1.5 +Version: 4.1.6 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/src/modules/Bootloader.rb b/src/modules/Bootloader.rb index 58c8688b5..63e0324ee 100644 --- a/src/modules/Bootloader.rb +++ b/src/modules/Bootloader.rb @@ -30,6 +30,7 @@ Yast.import "Progress" Yast.import "Report" Yast.import "Stage" +Yast.import "Installation" module Yast class BootloaderClass < Module @@ -422,7 +423,23 @@ def ReadOrProposeIfNeeded Propose() else progress_orig = Progress.set(false) + if Stage.initial && Mode.update + # SCR has been currently set to inst-sys. So we have + # set the SCR to installed system in order to read + # grub settings + old_SCR = WFM.SCRGetDefault + new_SCR = WFM.SCROpen("chroot=#{Yast::Installation.destdir}:scr", + false) + WFM.SCRSetDefault(new_SCR) + end Read() + if Stage.initial && Mode.update + # settings have been read from the target system + current_bl.read + # reset target system to inst-sys + WFM.SCRSetDefault(old_SCR) + WFM.SCRClose(new_SCR) + end Progress.set(progress_orig) end end diff --git a/test/bootloader_test.rb b/test/bootloader_test.rb index 84e13018c..dcba32ee2 100644 --- a/test/bootloader_test.rb +++ b/test/bootloader_test.rb @@ -110,6 +110,9 @@ def kernel_line(target) it "reads configuration in update mode" do expect(subject).to_not receive(:Propose) + # switching SCR to Yast::Installation.destdir + expect(Yast::WFM).to receive(:SCROpen).with("chroot=#{Yast::Installation.destdir}:scr", + false) expect(subject).to receive(:Read) allow(Yast::Mode).to receive(:update).and_return(true) allow(Yast::Stage).to receive(:initial).and_return(true)