Allow previewing an older NixOS release with --downgrade
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
This commit is contained in:
@@ -121,8 +121,8 @@ type UpgradeRun = UpdateStatus
|
||||
func (s System) UpgradeStatus() UpgradeRun { return unitRun("router-upgrade.service") }
|
||||
|
||||
// requestUpgrade asks the router-upgrade unit for one step.
|
||||
func (s System) requestUpgrade(action string, force bool, timeout string) error {
|
||||
data, _ := json.Marshal(map[string]any{"action": action, "force": force, "timeout": timeout})
|
||||
func (s System) requestUpgrade(action string, force, downgrade bool, timeout string) error {
|
||||
data, _ := json.Marshal(map[string]any{"action": action, "force": force, "downgrade": downgrade, "timeout": timeout})
|
||||
if err := os.MkdirAll(s.upgradeDir(), 0o700); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -254,7 +254,7 @@ func (a *app) upgradeStep(w http.ResponseWriter, r *http.Request, _ session) {
|
||||
a.upgradeBack(w, r, "Preview first: it says what would change.")
|
||||
return
|
||||
}
|
||||
if err := a.sys.requestUpgrade(action, r.PostFormValue("force") == "on", ""); err != nil {
|
||||
if err := a.sys.requestUpgrade(action, r.PostFormValue("force") == "on", r.PostFormValue("downgrade") == "on", ""); err != nil {
|
||||
a.upgradeBack(w, r, fmt.Sprintf("Could not start it: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user