Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from shundhammer/huha-os-prober
Add os-prober package (SLE-15-SP3)
- Loading branch information
Showing
12 changed files
with
170 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require "yast" | ||
|
||
Yast.import "Package" | ||
Yast.import "Arch" | ||
|
||
module Bootloader | ||
# Helper methods for the os-prober package | ||
class OsProber | ||
class << self | ||
def package_name | ||
"os-prober" | ||
end | ||
|
||
# Check if os-prober is supported on this architecture and if the package | ||
# is available | ||
def available? | ||
arch_supported? && package_available? | ||
end | ||
|
||
# Check if the os-prober package is available for installation | ||
def package_available? | ||
Yast::Package.Available(package_name) | ||
end | ||
|
||
# Check if os-prober is supported on this architecture | ||
def arch_supported? | ||
!Yast::Arch.s390 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "test_helper" | ||
|
||
describe Bootloader::OsProber do | ||
subject = described_class | ||
|
||
describe "#package_name" do | ||
it "Returns the correct package name" do | ||
expect(subject.package_name).to eq "os-prober" | ||
end | ||
end | ||
|
||
describe "#arch_supported?" do | ||
context "on non-s390 architectures" do | ||
before do | ||
allow(Yast::Arch).to receive(:s390).and_return(false) | ||
end | ||
|
||
it "os-prober is supported" do | ||
expect(subject.arch_supported?).to eq true | ||
end | ||
end | ||
|
||
context "on the s390 architecture" do | ||
before do | ||
allow(Yast::Arch).to receive(:s390).and_return(true) | ||
end | ||
|
||
it "os-prober is not supported" do | ||
expect(subject.arch_supported?).to eq false | ||
end | ||
end | ||
end | ||
|
||
describe "#available?" do | ||
context "on non-s390 architectures" do | ||
before do | ||
allow(Yast::Arch).to receive(:s390).and_return(false) | ||
end | ||
|
||
context "if the os-prober package is available" do | ||
before do | ||
allow(Yast::Package).to receive(:Available).and_return(true) | ||
end | ||
|
||
it "os-prober is available" do | ||
expect(subject.available?).to eq true | ||
end | ||
end | ||
|
||
context "if the os-prober package is not available" do | ||
before do | ||
allow(Yast::Package).to receive(:Available).and_return(false) | ||
end | ||
|
||
it "os-prober is not available" do | ||
expect(subject.available?).to eq false | ||
end | ||
end | ||
end | ||
end | ||
end |