Skip to content

Commit

Permalink
iot: conditionalize services on version
Browse files Browse the repository at this point in the history
In Fedora 42 and up Fedora IoT no longer includes zezere. This means the
enabled services need to be conditionalized on that version. Introduce a
new idiom to do this.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
  • Loading branch information
supakeen committed Feb 26, 2025
1 parent 8c03011 commit 4cee3be
Showing 1 changed file with 33 additions and 22 deletions.
55 changes: 33 additions & 22 deletions pkg/distro/fedora/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ var (
"/usr": 2 * datasizes.GiB,
}

// Services
iotServices = []string{
"NetworkManager.service",
"firewalld.service",
"sshd.service",
"greenboot-grub2-set-counter",
"greenboot-grub2-set-success",
"greenboot-healthcheck",
"greenboot-rpm-ostree-grub2-check-fallback",
"greenboot-status",
"greenboot-task-runner",
"redboot-auto-reboot",
"redboot-task-runner",
}

minimalRawServices = []string{
"NetworkManager.service",
"firewalld.service",
Expand Down Expand Up @@ -143,8 +128,7 @@ var (
osPkgsKey: packageSetLoader,
},
defaultImageConfig: &distro.ImageConfig{
EnabledServices: iotServices,
DracutConf: []*osbuild.DracutConfStageOptions{osbuild.FIPSDracutConfStageOptions},
DracutConf: []*osbuild.DracutConfStageOptions{osbuild.FIPSDracutConfStageOptions},
},
rpmOstree: true,
image: iotCommitImage,
Expand Down Expand Up @@ -181,8 +165,7 @@ var (
},
},
defaultImageConfig: &distro.ImageConfig{
EnabledServices: iotServices,
DracutConf: []*osbuild.DracutConfStageOptions{osbuild.FIPSDracutConfStageOptions},
DracutConf: []*osbuild.DracutConfStageOptions{osbuild.FIPSDracutConfStageOptions},
},
rpmOstree: true,
bootISO: false,
Expand All @@ -202,8 +185,7 @@ var (
installerPkgsKey: packageSetLoader,
},
defaultImageConfig: &distro.ImageConfig{
Locale: common.ToPtr("en_US.UTF-8"),
EnabledServices: iotServices,
Locale: common.ToPtr("en_US.UTF-8"),
},
rpmOstree: true,
bootISO: true,
Expand All @@ -223,7 +205,6 @@ var (
installerPkgsKey: packageSetLoader,
},
defaultImageConfig: &distro.ImageConfig{
EnabledServices: iotServices,
Keyboard: &osbuild.KeymapStageOptions{
Keymap: "us",
},
Expand Down Expand Up @@ -700,6 +681,8 @@ func newDistro(version int) distro.Distro {
minimalrawZstdImgType.payloadPipelines = []string{"os", "image", "zstd"}
minimalrawZstdImgType.exports = []string{"zstd"}

// set iot services (these are version-dependent)

x86_64.addImageTypes(
&platform.X86{
BIOS: true,
Expand Down Expand Up @@ -773,6 +756,7 @@ func newDistro(version int) distro.Distro {
liveInstallerImgType.defaultInstallerConfig = distroInstallerConfig
imageInstallerImgType.defaultInstallerConfig = distroInstallerConfig
iotInstallerImgType.defaultInstallerConfig = distroInstallerConfig

x86_64.addImageTypes(
&platform.X86{
BasePlatform: platform.BasePlatform{
Expand Down Expand Up @@ -1114,3 +1098,30 @@ func DistroFactory(idStr string) distro.Distro {

return newDistro(id.MajorVersion)
}

func iotServicesForVersion(d *distribution) []string {

Check failure on line 1102 in pkg/distro/fedora/distro.go

View workflow job for this annotation

GitHub Actions / ⌨ Lint

func `iotServicesForVersion` is unused (unused)
services := []string{
"NetworkManager.service",
"firewalld.service",
"sshd.service",
"greenboot-grub2-set-counter",
"greenboot-grub2-set-success",
"greenboot-healthcheck",
"greenboot-rpm-ostree-grub2-check-fallback",
"greenboot-status",
"greenboot-task-runner",
"redboot-auto-reboot",
"redboot-task-runner",
}

if common.VersionLessThan(d.osVersion, "42") {
services = append(services, []string{
"zezere_ignition.timer",
"zezere_ignition_banner.service",
"parsec",
"dbus-parsec",
}...)
}

return services
}

0 comments on commit 4cee3be

Please sign in to comment.