Skip to content

Commit 63ccbc7

Browse files
committed
saves configuration to new root after upgrade
1 parent eeaad76 commit 63ccbc7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

core/system.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation) error {
408408
return pkgM.ClearUnstagedPackages()
409409
}, nil, 10, &goodies.NoErrorHandler{}, false)
410410

411-
// Stage 5: Write abimage.abr.new to future/
411+
// Stage 5: Write abimage.abr.new and config to future/
412412
// ------------------------------------------------
413413
PrintVerboseSimple("[Stage 5] -------- ABSystemRunOperation")
414414

@@ -430,6 +430,12 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation) error {
430430
return err
431431
}
432432

433+
err = settings.WriteConfigToFile(filepath.Join(systemNew, "/usr/share/abroot/abroot.json"))
434+
if err != nil {
435+
PrintVerboseErr("ABSystem.RunOperation", 5.25, err)
436+
return err
437+
}
438+
433439
// from this point on, it is not possible to stop the upgrade
434440
// so we remove the stage file. Note that interrupting the upgrade
435441
// from this point on will not leave the system in an inconsistent

settings/config.go

+5
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,8 @@ func init() {
130130

131131
Cnf.FullImageName = fmt.Sprintf("%s/%s:%s", Cnf.Registry, Cnf.Name, Cnf.Tag)
132132
}
133+
134+
// WriteConfigToFile writes the current configuration to a file
135+
func WriteConfigToFile(file string) error {
136+
return viper.WriteConfigAs(file)
137+
}

0 commit comments

Comments
 (0)