Move kernelCmdlineStageOptions() from distros to osbuild2
Move the `kernelCmdlineStageOptions()` function duplicated in many distro definitions to the `osbuild2` package as `NewKernelCmdlineStageOptions()`. This will prevent creating another copy of the code in rhel-84 for the `gce` image. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
43bfcc5389
commit
a392d71da6
9 changed files with 11 additions and 32 deletions
|
|
@ -68,7 +68,7 @@ func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *dis
|
|||
if rootPartition == nil {
|
||||
panic("s390x image must have a root partition, this is a programming error")
|
||||
}
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(kernelCmdlineStageOptions(rootPartition.Filesystem.UUID, t.kernelOptions))
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootPartition.Filesystem.UUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
}
|
||||
return pipeline
|
||||
|
|
|
|||
|
|
@ -532,13 +532,6 @@ func qemuStageOptions(filename, format, compat string) *osbuild.QEMUStageOptions
|
|||
}
|
||||
}
|
||||
|
||||
func kernelCmdlineStageOptions(rootUUID string, kernelOptions string) *osbuild.KernelCmdlineStageOptions {
|
||||
return &osbuild.KernelCmdlineStageOptions{
|
||||
RootFsUUID: rootUUID,
|
||||
KernelOpts: kernelOptions,
|
||||
}
|
||||
}
|
||||
|
||||
func nginxConfigStageOptions(path, htmlRoot, listen string) *osbuild.NginxConfigStageOptions {
|
||||
// configure nginx to work in an unprivileged container
|
||||
cfg := &osbuild.NginxConfig{
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *dis
|
|||
if rootPartition == nil {
|
||||
panic("s390x image must have a root partition, this is a programming error")
|
||||
}
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(kernelCmdlineStageOptions(rootPartition.Filesystem.UUID, t.kernelOptions))
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootPartition.Filesystem.UUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
}
|
||||
return pipeline
|
||||
|
|
|
|||
|
|
@ -573,13 +573,6 @@ func qemuStageOptions(filename, format, compat string) *osbuild.QEMUStageOptions
|
|||
}
|
||||
}
|
||||
|
||||
func kernelCmdlineStageOptions(rootUUID string, kernelOptions string) *osbuild.KernelCmdlineStageOptions {
|
||||
return &osbuild.KernelCmdlineStageOptions{
|
||||
RootFsUUID: rootUUID,
|
||||
KernelOpts: kernelOptions,
|
||||
}
|
||||
}
|
||||
|
||||
func nginxConfigStageOptions(path, htmlRoot, listen string) *osbuild.NginxConfigStageOptions {
|
||||
// configure nginx to work in an unprivileged container
|
||||
cfg := &osbuild.NginxConfig{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti
|
|||
|
||||
func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *disk.PartitionTable) *osbuild.Pipeline {
|
||||
rootFsUUID := pt.RootPartition().Filesystem.UUID
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(kernelCmdlineStageOptions(rootFsUUID, t.kernelOptions))
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFsUUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
return pipeline
|
||||
}
|
||||
|
|
|
|||
|
|
@ -574,13 +574,6 @@ func qemuStageOptions(filename, format, compat string) *osbuild.QEMUStageOptions
|
|||
}
|
||||
}
|
||||
|
||||
func kernelCmdlineStageOptions(rootUUID string, kernelOptions string) *osbuild.KernelCmdlineStageOptions {
|
||||
return &osbuild.KernelCmdlineStageOptions{
|
||||
RootFsUUID: rootUUID,
|
||||
KernelOpts: kernelOptions,
|
||||
}
|
||||
}
|
||||
|
||||
func nginxConfigStageOptions(path, htmlRoot, listen string) *osbuild.NginxConfigStageOptions {
|
||||
// configure nginx to work in an unprivileged container
|
||||
cfg := &osbuild.NginxConfig{
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti
|
|||
|
||||
func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *disk.PartitionTable) *osbuild.Pipeline {
|
||||
rootFsUUID := pt.RootPartition().Filesystem.UUID
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(kernelCmdlineStageOptions(rootFsUUID, t.kernelOptions))
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFsUUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
return pipeline
|
||||
}
|
||||
|
|
|
|||
|
|
@ -505,10 +505,3 @@ func qemuStageOptions(filename, format, compat string) *osbuild.QEMUStageOptions
|
|||
Format: options,
|
||||
}
|
||||
}
|
||||
|
||||
func kernelCmdlineStageOptions(rootUUID string, kernelOptions string) *osbuild.KernelCmdlineStageOptions {
|
||||
return &osbuild.KernelCmdlineStageOptions{
|
||||
RootFsUUID: rootUUID,
|
||||
KernelOpts: kernelOptions,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,3 +17,10 @@ func NewKernelCmdlineStage(options *KernelCmdlineStageOptions) *Stage {
|
|||
Options: options,
|
||||
}
|
||||
}
|
||||
|
||||
func NewKernelCmdlineStageOptions(rootUUID string, kernelOptions string) *KernelCmdlineStageOptions {
|
||||
return &KernelCmdlineStageOptions{
|
||||
RootFsUUID: rootUUID,
|
||||
KernelOpts: kernelOptions,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue