Skip to content

Commit

Permalink
feat:add dropin to disable grub timer
Browse files Browse the repository at this point in the history
This will disable the grub-boot-success timer
if greenboot exists to ensure greenboot functions
correctly and the timer does not modify the
boot_success flag when a ssh session persits for
more than 2 min. This customization is added to
containerImage and edgeCommitImage.

Signed-off-by: Sayan Paul <paul.sayan@gmail.com>
  • Loading branch information
say-paul authored and achilleas-k committed Aug 17, 2023
1 parent 96d4092 commit e383fd0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/distro/rhel9/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ func edgeCommitImage(workload workload.Workload,
if !common.VersionLessThan(t.arch.distro.osVersion, "9.2") || t.arch.distro.osVersion == "9-stream" {
img.OSCustomizations.EnabledServices = append(img.OSCustomizations.EnabledServices, "ignition-firstboot-complete.service", "coreos-ignition-write-issues.service")
}
img.OSCustomizations.SystemdUnit = []*osbuild.SystemdUnitStageOptions{
{
Unit: "grub-boot-success.timer",
Dropin: "10-disable-if-greenboot.conf",
UnitType: osbuild.Global,
Config: osbuild.SystemdServiceUnitDropin{
Unit: &osbuild.SystemdUnitSection{
FileExists: "!/usr/libexec/greenboot/greenboot",
},
},
},
}
img.Environment = t.environment
img.Workload = workload

Expand Down Expand Up @@ -334,6 +346,19 @@ func edgeContainerImage(workload workload.Workload,
img.OSCustomizations.EnabledServices = append(img.OSCustomizations.EnabledServices, "ignition-firstboot-complete.service", "coreos-ignition-write-issues.service")
}

img.OSCustomizations.SystemdUnit = []*osbuild.SystemdUnitStageOptions{
{
Unit: "grub-boot-success.timer",
Dropin: "10-disable-if-greenboot.conf",
UnitType: osbuild.Global,
Config: osbuild.SystemdServiceUnitDropin{
Unit: &osbuild.SystemdUnitSection{
FileExists: "!/usr/libexec/greenboot/greenboot",
},
},
},
}

return img, nil
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/manifest/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ func (p *OS) serialize() osbuild.Pipeline {
pipeline.AddStage(osbuild.NewOscapRemediationStage(p.OpenSCAPConfig))
}

for _, dropin := range p.SystemdUnit {
pipeline.AddStage(osbuild.NewSystemdUnitStage(dropin))
}

if p.SElinux != "" {
pipeline.AddStage(osbuild.NewSELinuxStage(&osbuild.SELinuxStageOptions{
FileContexts: fmt.Sprintf("etc/selinux/%s/contexts/files/file_contexts", p.SElinux),
Expand Down

0 comments on commit e383fd0

Please sign in to comment.