summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHermes Agent <hermes@localhost>2026-08-12 03:53:08 +0000
committerHermes Agent <hermes@localhost>2026-08-12 03:53:08 +0000
commit815ec6e06e05f03022c2076f6e8573f1d2c454c9 (patch)
tree1cfd033f74ec4c4c617e7e410e0d2ea16e595e13 /src
parent0fad03030080f99d7d1e0a360146f66245165eae (diff)
Avoid duplicate initrd manifest facts
Diffstat (limited to 'src')
-rw-r--r--src/manifest.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/manifest.rs b/src/manifest.rs
index 6168706..8e9d13c 100644
--- a/src/manifest.rs
+++ b/src/manifest.rs
@@ -69,7 +69,7 @@ impl ArtifactManifest {
}
Self::new(
packages,
- collect_files(rootfs)?,
+ collect_files(rootfs, initrd.as_ref())?,
initrd,
collect_services(rootfs)?,
collect_archive_members(archive.as_ref())?,
@@ -119,7 +119,9 @@ impl ArtifactManifest {
bail!("multiple initrd images found in archive {}", archive_path.display());
}
}
- files.push(FileRecord::file(path, digest));
+ if !path.starts_with("boot/initrd-") || !path.ends_with(".img") {
+ files.push(FileRecord::file(path, digest));
+ }
}
EntryType::Symlink => {
let target = entry
@@ -153,7 +155,7 @@ impl ArtifactManifest {
}
}
-fn collect_files(rootfs: &Path) -> Result<Vec<FileRecord>> {
+fn collect_files(rootfs: &Path, initrd: Option<&InitrdRecord>) -> Result<Vec<FileRecord>> {
let mut files = Vec::new();
let mut entries = WalkDir::new(rootfs)
.follow_links(false)
@@ -169,6 +171,9 @@ fn collect_files(rootfs: &Path) -> Result<Vec<FileRecord>> {
continue;
}
let path = portable_path(relative)?;
+ if initrd.is_some_and(|record| record.path == path) {
+ continue;
+ }
let file_type = entry.file_type();
if file_type.is_file() {
let metadata = entry.metadata().with_context(|| format!("inspect rootfs file {}", entry.path().display()))?;