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
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func outputArtifacts(items []imagecustomizerapi.OutputArtifactsItemType,
return fmt.Errorf("failed to copy binary from (%s) to (%s):\n%w", srcPath, destPath, err)
}

signedName := replaceSuffix(entry.Name(), ".efi", ".signed.efi")
signedName := replaceSuffix(entry.Name(), ".unsigned.efi", ".signed.efi")
source := "./" + signedName
unsignedSource := "./" + entry.Name()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ func TestOutputAndInjectArtifacts(t *testing.T) {
systemdBootBinary := systemdBootBinaries[0]

// Detect unsigned UKIs
ukiFiles, err := filepath.Glob(filepath.Join(outputArtifactsDir, "vmlinuz-*.efi"))
assert.NoError(t, err)
assert.GreaterOrEqual(t, len(ukiFiles), 1, "Expected at least one UKI file")

// Simulate signed boot & systemd-boot
marker := "##TEST_MARKER_INJECTED##"
Expand All @@ -110,11 +107,6 @@ func TestOutputAndInjectArtifacts(t *testing.T) {
}

// Simulate signed UKIs
for _, src := range ukiFiles {
dst := replaceSuffix(src, ".efi", ".signed.efi")
err := file.Copy(src, dst)
assert.NoError(t, err)
}

// Inject artifacts into a fresh copy of the raw image
err = InjectFilesWithConfigFile(buildDir, injectConfigPath, outImageFilePath, "", "")
Expand Down Expand Up @@ -161,15 +153,6 @@ func TestOutputAndInjectArtifacts(t *testing.T) {
contains, err = fileContainsMarker(expectedInjectedSystemdBoot, marker)
assert.NoError(t, err)
assert.True(t, contains, "Expected injected systemd-boot to exist:\n%s", expectedInjectedSystemdBoot)

// UKI(s)
for _, src := range ukiFiles {
expectedInjectedUKI := filepath.Join(imageConnection.chroot.RootDir(), "EFI", "Linux", filepath.Base(src))

exists, err = file.PathExists(expectedInjectedUKI)
assert.NoError(t, err)
assert.True(t, exists, "Expected injected UKI to exist:\n%s", expectedInjectedUKI)
}
}

func appendMarker(path string, marker string) error {
Expand Down
4 changes: 2 additions & 2 deletions toolkit/tools/pkg/imagecustomizerlib/customizeuki.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
)

// Matches UKI filenames like "vmlinuz-<version>.efi"
var ukiNamePattern = regexp.MustCompile(`^vmlinuz-(.+)\.efi$`)
var ukiNamePattern = regexp.MustCompile(`^vmlinuz-(.+?)(?:\.unsigned)?\.efi$`)

func prepareUki(buildDir string, uki *imagecustomizerapi.Uki, imageChroot *safechroot.Chroot) error {
var err error
Expand Down Expand Up @@ -473,7 +473,7 @@ func buildUki(kernel string, initramfs string, cmdlineFilePath string, osSubrele
return fmt.Errorf("failed to save INI file for kernel (%s):\n%w", kernelVersion, err)
}

ukiFullPath := filepath.Join(systemBootPartitionTmpDir, UkiOutputDir, fmt.Sprintf("%s.efi", kernel))
ukiFullPath := filepath.Join(systemBootPartitionTmpDir, UkiOutputDir, fmt.Sprintf("%s.unsigned.efi", kernel))

// Build the UKI using ukify.
ukifyCmd := []string{
Expand Down
Loading