Skip to content

Commit 6340fa0

Browse files
Paul Whalensupakeen
authored andcommitted
Make bootupd metadata generation configurable per distro
Add a configurable option for bootupd metadata generation that allows distributions to enable it only where the bootupd package is available. This introduces the bootupd_gen_metadata field in ImageConfig, which controls whether bootupctl backend generate-update-metadata is run for ostree commits. Distributions can set this conditionally based on version to ensure bootupctl is only invoked when bootupd is present. Signed-off-by: Paul Whalen <[email protected]>
1 parent 79688cd commit 6340fa0

12 files changed

+30
-8
lines changed

data/distrodefs/fedora/imagetypes.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,7 @@ image_types:
11011101
required_partition_sizes: *default_required_dir_sizes
11021102
image_config: &image_config_iot_commit
11031103
<<: *image_config_iot_enabled_services
1104+
bootupd_gen_metadata: true
11041105
install_weak_deps: false
11051106
dracut_conf:
11061107
- filename: "40-fips.conf"

pkg/distro/generic/images.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,11 @@ func iotCommitImage(t *imageType,
692692
img.OSTreeParent = parentCommit
693693
img.OSVersion = d.OsVersion()
694694

695+
// Enable bootupd metadata generation if configured
696+
if imgConfig.BootupdGenMetadata != nil && *imgConfig.BootupdGenMetadata {
697+
img.Bootupd = true
698+
}
699+
695700
return img, nil
696701
}
697702

pkg/distro/image_config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ type ImageConfig struct {
146146
// This is only supported for distributions that use dnf4, because osbuild
147147
// only has a stage for dnf4 version locking.
148148
VersionlockPackages []string `yaml:"versionlock_packages,omitempty"`
149+
150+
// BootupdGenMetadata enables bootupd metadata generation for ostree commits.
151+
// When enabled, runs bootupctl backend generate-update-metadata to transform
152+
// /usr/lib/ostree-boot into bootupd-compatible update metadata.
153+
// Only set this to true if the bootupd package is available in the image.
154+
BootupdGenMetadata *bool `yaml:"bootupd_gen_metadata,omitempty"`
149155
}
150156

151157
// shallowMerge creates a new struct by merging a child and a parent.

pkg/image/ostree_archive.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ type OSTreeArchive struct {
3535
// kernel arguments for bootable containers.
3636
// This is ignored if BootContainer = false.
3737
BootcConfig *bootc.Config
38+
39+
// Bootupd enables bootupd metadata generation for ostree commits.
40+
// When true, runs bootupctl backend generate-update-metadata to
41+
// transform /usr/lib/ostree-boot into bootupd-compatible update metadata.
42+
Bootupd bool
3843
}
3944

4045
func NewOSTreeArchive(platform platform.Platform, filename string, ref string) *OSTreeArchive {
@@ -62,6 +67,11 @@ func (img *OSTreeArchive) InstantiateManifest(m *manifest.Manifest,
6267
ostreeCommitPipeline := manifest.NewOSTreeCommit(buildPipeline, osPipeline, img.OSTreeRef)
6368
ostreeCommitPipeline.OSVersion = img.OSVersion
6469

70+
// Enable bootupd metadata generation if requested
71+
if img.Bootupd {
72+
osPipeline.Bootupd = true
73+
}
74+
6575
var artifact *artifact.Artifact
6676
if img.BootContainer {
6777
osPipeline.Bootupd = true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0d8647e30cbfbd1952e65b6e4b36598844be1da0
1+
c540dc8d8e97660e0a48f5aae301c6584557359c
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2511d968a93611b29c94b1760d928468dadf4725
1+
c00040172030f8478d32ccb5af85691d9c5589d8
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d7e796b6fe57a024e52e270bab1818f056bad046
1+
145d137a4a535550d2dcbf0b29d8deb01a3f60e9
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8bdca7e7c28d21bf9d3e9682470ca721a882a4f1
1+
0934744341c57dd66b19c7550de9866bf6f4aafb
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ecb284cf29f596e99fef5d7e333aad3546545ae9
1+
f5d6b8eb561fbbd8357f5bd0d5f0ff08f2538cf2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5acc55ef5dff2fc0fffe534197552c872bc8ed2c
1+
e23cdab4086735921d1e85dbd78e6c252ef0900f

0 commit comments

Comments
 (0)