@@ -28,6 +28,7 @@ import (
2828 "time"
2929
3030 "github.com/mudler/yip/pkg/schema"
31+
3132 "github.com/rancher/elemental-toolkit/pkg/constants"
3233 "github.com/rancher/elemental-toolkit/pkg/elemental"
3334 elementalError "github.com/rancher/elemental-toolkit/pkg/error"
@@ -49,12 +50,12 @@ const (
4950
5051type BuildDiskAction struct {
5152 cfg * v1.BuildConfig
52- spec * v1.Disk
53+ spec * v1.DiskSpec
5354 // holds the root path within the working directory of all partitions
5455 roots map [string ]string
5556}
5657
57- func NewBuildDiskAction (cfg * v1.BuildConfig , spec * v1.Disk ) * BuildDiskAction {
58+ func NewBuildDiskAction (cfg * v1.BuildConfig , spec * v1.DiskSpec ) * BuildDiskAction {
5859 return & BuildDiskAction {cfg : cfg , spec : spec }
5960}
6061
@@ -161,29 +162,23 @@ func (b *BuildDiskAction) BuildDiskRun() (err error) { //nolint:gocyclo
161162 return err
162163 }
163164
164- err = grub .SetPersistentVariables (
165- filepath .Join (b .roots [constants .OEMPartName ], constants .GrubEnv ),
166- map [string ]string {
167- "next_entry" : constants .RecoveryImgName ,
168- },
169- )
170- if err != nil {
171- b .cfg .Logger .Errorf ("failed setting firstboot menu entry: %s" , err .Error ())
172- return err
165+ if b .spec .Expandable {
166+ err = grub .SetPersistentVariables (
167+ filepath .Join (b .roots [constants .OEMPartName ], constants .GrubEnv ),
168+ map [string ]string {
169+ "next_entry" : constants .RecoveryImgName ,
170+ },
171+ )
172+ if err != nil {
173+ b .cfg .Logger .Errorf ("failed setting firstboot menu entry: %s" , err .Error ())
174+ return err
175+ }
173176 }
174177
178+ grubVars := b .spec .GetGrubLabels ()
175179 err = grub .SetPersistentVariables (
176180 filepath .Join (b .roots [constants .StatePartName ], constants .GrubOEMEnv ),
177- map [string ]string {
178- "efi_label" : b .spec .Partitions .EFI .FilesystemLabel ,
179- "oem_label" : b .spec .Partitions .OEM .FilesystemLabel ,
180- "recovery_label" : b .spec .Partitions .Recovery .FilesystemLabel ,
181- "state_label" : b .spec .Partitions .State .FilesystemLabel ,
182- "persistent_label" : b .spec .Partitions .Persistent .FilesystemLabel ,
183- "active_label" : b .spec .Active .Label ,
184- "passive_label" : b .spec .Passive .Label ,
185- "system_label" : b .spec .Recovery .Label ,
186- },
181+ grubVars ,
187182 )
188183 if err != nil {
189184 b .cfg .Logger .Errorf ("failed setting grub environment variables: %s" , err .Error ())
0 commit comments