Skip to content

Commit c9fee1e

Browse files
committed
Match initrd os-release candidates as relative cpio paths
1 parent 962c94a commit c9fee1e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

toolkit/tools/internal/targetos/targetos.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,19 @@ var (
8181
}
8282

8383
// initrdReleaseCandidates lists the in-initrd paths to probe for an os-release(5)-type file, in preference order.
84+
// These are matched against cpio member names, which are stored relative to the archive root, so they must not have
85+
// a leading slash.
8486
//
8587
// os-release is the canonical filename and is the only candidate present in full-OS initrds built by Image
8688
// Customizer (which pack the source rootfs directly, in which initrd-release does not exist at all).
8789
//
8890
// initrd-release is the dracut-runtime variant emitted by dracut's 99base module. os-release symlinks to this file
8991
// in such cases, so it is a necessary fallback.
9092
initrdReleaseCandidates = []string{
91-
"/etc/os-release",
92-
"/usr/lib/os-release",
93-
"/etc/initrd-release",
94-
"/usr/lib/initrd-release",
93+
"etc/os-release",
94+
"usr/lib/os-release",
95+
"etc/initrd-release",
96+
"usr/lib/initrd-release",
9597
}
9698
)
9799

0 commit comments

Comments
 (0)