Skip to content
Merged
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
18 changes: 14 additions & 4 deletions service/lib/agama/storage/finisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ class CopyFilesStep < Step
FILES = [
{ dir: "/etc/udev/rules.d", file: "40-*" },
{ dir: "/etc/udev/rules.d", file: "41-*" },
{ dir: "/etc/udev/rules.d", file: "70-persistent-net.rules" }
{ dir: "/etc/udev/rules.d", file: "70-persistent-net.rules" },
# Copy /etc/nvme/host* to keep NVMe working after installation, bsc#1238038
{ dir: "/etc/nvme", file: "hostnqn" },
{ dir: "/etc/nvme", file: "hostid" }
].freeze

def label
Expand All @@ -142,9 +145,12 @@ def run?
end

def run
target = File.join(Yast::Installation.destdir, UDEV_RULES_DIR)
FileUtils.mkdir_p(target)
FileUtils.cp(glob_files, target)
glob_files.each do |file|
target = File.dirname(file).sub(root_dir, dest_dir)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This relies in the fact that dest_dir includes a final slash. That is, is "/mnt/". It would not work if dest_dir is "/mnt" (without the trailing slash). But I guess we can live with that.


FileUtils.mkdir_p(target)
FileUtils.cp(file, target)
end
end

private
Expand All @@ -153,6 +159,10 @@ def root_dir
ROOT_PATH
end

def dest_dir
Yast::Installation.destdir
end

def glob_files
Dir.glob(FILES.map { |f| File.join(root_dir, f[:dir], f[:file]) })
end
Expand Down
7 changes: 7 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Apr 11 09:07:22 UTC 2025 - Michal Filka <mfilka@suse.com>

- bsc#1238038
- copy NVMe configuration files from inst-sys to target
(gh#agama-project/agama#2257).

-------------------------------------------------------------------
Thu Apr 10 20:26:29 UTC 2025 - Josef Reidinger <jreidinger@suse.com>

Expand Down
12 changes: 12 additions & 0 deletions service/test/agama/storage/finisher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,25 @@
"41-qeth-0.0.0800.rules", "70-persistent-net.rules"
]
end
let(:nvme_files) do
[
"hostnqn", "hostid"
]
end

it "copies some specific udev rules to the target system when exist" do
subject.run
rules.each do |rule|
expect(File.exist?(File.join(destdir, "/etc/udev/rules.d/#{rule}"))).to eql(true)
end
end

it "copies some specific NVMe configuration files to the target system" do
subject.run
nvme_files.each do |file|
expect(File.exist?(File.join(destdir, "/etc/nvme/#{file}"))).to eql(true)
end
end
end
end

Expand Down
Empty file.
Empty file.
Loading