Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion library/system/src/modules/Kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def ParseInstallationKernelCmdline
# not using dedicated agent in order to use the same parser for cmdline
# independently on whether it comes from /proc/cmdline or /etc/install.inf
# use local read as it does not make sense to depend on binding it to chroot
WFM.Read(path(".local.string"), "/proc/cmdline").to_s
# and first check if there is dedicated agama filtered kernel parameters (bsc#1234678)
agama_path = "/run/agama/cmdline.d/kernel"
file_path = File.exist?(agama_path) ? agama_path : "/proc/cmdline"
WFM.Read(path(".local.string"), file_path).to_s
else
SCR.Read(path(".etc.install_inf.Cmdline")).to_s
end
Expand Down
38 changes: 38 additions & 0 deletions library/system/test/kernel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,44 @@
allow(Yast::Arch).to receive(:architecture).and_return("x86_64")
end

context "if install.inf is not available" do
let(:cmdline) { "splash=verbose silent" }
before do
allow(Yast::SCR).to receive(:Dir).with(path(".etc.install_inf")).and_return([])
allow(::File).to receive(:exist?).and_call_original
end

context "if /run/agama/cmdline.d/kernel is available" do
before do
expect(::File).to receive(:exist?).with("/run/agama/cmdline.d/kernel")
.and_return(true)
allow(Yast::WFM).to receive(:Read)
.with(path(".local.string"), "/run/agama/cmdline.d/kernel")
.and_return(cmdline)
end

it "reads kernel command line from /run/agama/cmdline.d/kernel" do
subject.ParseInstallationKernelCmdline
expect(subject.GetCmdLine).to eq " splash=verbose silent"
end
end

context "if /run/agama/cmdline.d/kernel is not available" do
before do
expect(::File).to receive(:exist?).with("/run/agama/cmdline.d/kernel")
.and_return(false)
allow(Yast::WFM).to receive(:Read)
.with(path(".local.string"), "/proc/cmdline")
.and_return(cmdline)
end

it "reads kernel command line from /proc/cmdline" do
subject.ParseInstallationKernelCmdline
expect(subject.GetCmdLine).to eq " splash=verbose silent"
end
end
end

context "for common options" do
let(:cmdline) { "splash=verbose silent" }

Expand Down