Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saves configuration to new root after upgrade #319

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}