Skip to content

Commit

Permalink
Add support to install missing packages on running system
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Mar 2, 2016
1 parent 2770180 commit 29591b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/bootloader/bootloader_base.rb
Expand Up @@ -4,6 +4,7 @@
Yast.import "BootStorage"
Yast.import "Linuxrc"
Yast.import "Mode"
Yast.import "PackageSystem"

module Bootloader
# Represents base for all kinds of bootloaders
Expand All @@ -16,6 +17,8 @@ def initialize
# writes configuration to target disk
def write
write_sysconfig
# in running system install package, for other modes, it need specific handling
Yast::PackageSystem.InstallAll(packages) if Yast::Mode.normal
end

# reads configuration from target disk
Expand Down
15 changes: 14 additions & 1 deletion test/bootloader_base_test.rb
Expand Up @@ -4,16 +4,29 @@

describe Bootloader::BootloaderBase do
describe "#write" do
it "writes to sysconfig name of its child" do
before do
allow(Bootloader::Sysconfig).to receive(:new).and_return(double(write: nil))
allow(Yast::PackageSystem).to receive(:InstallAll)

subject.define_singleton_method(:name) { "funny_bootloader" }
end

it "writes to sysconfig name of its child" do
sysconfig = double(Bootloader::Sysconfig, write: nil)
expect(Bootloader::Sysconfig).to receive(:new)
.with(bootloader: "funny_bootloader")
.and_return(sysconfig)

subject.write
end

context "Mode.normal is set" do
it "install packages listed required by bootloader from packages method" do
expect(Yast::PackageSystem).to receive(:InstallAll).with(["kexec-tools"])

subject.write
end
end
end

describe "#read" do
Expand Down

1 comment on commit 29591b6

@cwh42
Copy link
Contributor

@cwh42 cwh42 commented on 29591b6 Mar 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Please sign in to comment.