From 94b2c3ba845a1501aad9f577ae1211cd264c0f1c Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Tue, 25 Feb 2025 17:01:26 -0700 Subject: [PATCH] Add support for ubuntu-style dracut image names Signed-off-by: Jonathon Anderson --- CHANGELOG.md | 4 ++++ internal/pkg/image/initramfs.go | 1 + internal/pkg/image/initramfs_test.go | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b7700a..378325b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## v4.6.0, unreleased +### Added + +- Support Ubuntu-style dracut initrd images. + ### Fixed - Fix nightly builds. diff --git a/internal/pkg/image/initramfs.go b/internal/pkg/image/initramfs.go index 85a69010..0a7b7777 100644 --- a/internal/pkg/image/initramfs.go +++ b/internal/pkg/image/initramfs.go @@ -14,6 +14,7 @@ var ( initramfsSearchPaths = []string{ "/boot/initramfs-*", "/boot/initrd-*", + "/boot/initrd.img-*", } versionPattern *regexp.Regexp diff --git a/internal/pkg/image/initramfs_test.go b/internal/pkg/image/initramfs_test.go index ce81c98f..0f4f680d 100644 --- a/internal/pkg/image/initramfs_test.go +++ b/internal/pkg/image/initramfs_test.go @@ -20,7 +20,6 @@ func TestFindInitramfs(t *testing.T) { assert.NoError(t, os.MkdirAll(filepath.Join(RootFsDir("image"), "boot"), 0700)) tests := map[string]struct { - name string initramfs []string ver string path string @@ -45,6 +44,11 @@ func TestFindInitramfs(t *testing.T) { ver: "1.1.1", path: "/boot/initrd-1.1.1.aarch64.img", }, + "ok case 5 (ubuntu)": { + initramfs: []string{"/boot/initrd.img-6.11.0-18-generic"}, + ver: "6.11.0-18", + path: "/boot/initrd.img-6.11.0-18-generic", + }, "prefix match": { initramfs: []string{"/boot/initrd-1.1.1.aarch64.img"}, ver: "1.1",