Skip to content

Commit

Permalink
saves configuration to new root after upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
taukakao committed Jul 12, 2024
1 parent eeaad76 commit 63ccbc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation) error {
return pkgM.ClearUnstagedPackages()
}, nil, 10, &goodies.NoErrorHandler{}, false)

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

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

err = settings.WriteConfigToFile(filepath.Join(systemNew, "/usr/share/abroot/abroot.json"))
if err != nil {
PrintVerboseErr("ABSystem.RunOperation", 5.25, err)
return err
}

// from this point on, it is not possible to stop the upgrade
// so we remove the stage file. Note that interrupting the upgrade
// from this point on will not leave the system in an inconsistent
Expand Down
5 changes: 5 additions & 0 deletions settings/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,8 @@ func init() {

Cnf.FullImageName = fmt.Sprintf("%s/%s:%s", Cnf.Registry, Cnf.Name, Cnf.Tag)
}

// WriteConfigToFile writes the current configuration to a file
func WriteConfigToFile(file string) error {
return viper.WriteConfigAs(file)
}

0 comments on commit 63ccbc7

Please sign in to comment.