Reduce the number of bootenv vars
This commit is contained in:
@@ -19,12 +19,39 @@ func ConfigureABBoot(ctx context.Context, nctx *node.NodeContext) error {
|
||||
|
||||
// TODO: configurable from cluster.env
|
||||
return writer.EnsureBootEnv(ctx, BootEnvConfig{
|
||||
BootSource: "usb",
|
||||
BootPart: "A",
|
||||
BootDisk: 0,
|
||||
RootfsAPartNum: 2,
|
||||
RootfsBPartNum: 3,
|
||||
DataPartNum: 4,
|
||||
LinuxRootPrefix: "/dev/sda",
|
||||
BootSource: "usb",
|
||||
BootPart: "A",
|
||||
})
|
||||
}
|
||||
|
||||
// This is called by the agent controller/osupgrade/handler.go
|
||||
func ConfigureNextBoot(ctx context.Context, fwEnvCfgPath string) error {
|
||||
|
||||
exePath, err := os.Executable()
|
||||
if err != nil {
|
||||
return fmt.Errorf("get current executable path: %w", err)
|
||||
}
|
||||
|
||||
writer := NewFWEnvWriter(fwEnvCfgPath, exePath)
|
||||
|
||||
currBootPart, err := writer.GetEnv(ctx, "boot_part")
|
||||
if err != nil {
|
||||
return fmt.Errorf("get boot_part: %w", err)
|
||||
}
|
||||
|
||||
next := "A"
|
||||
if currBootPart == "A" {
|
||||
next = "B"
|
||||
|
||||
}
|
||||
|
||||
currBootSource, err := writer.GetEnv(ctx, "boot_source")
|
||||
if err != nil {
|
||||
return fmt.Errorf("get boot_source: %w", err)
|
||||
}
|
||||
|
||||
return writer.EnsureBootEnv(ctx, BootEnvConfig{
|
||||
BootSource: currBootSource,
|
||||
BootPart: next,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user