Files
nixos-router/pkgs/router-webui/gitupdate.go
T
nilsandClaude Sonnet 5.5 2b7cd86e98 One upgrade for nixos-router and the packages
Check, preview and apply look at the repository's release tags and the
channel together; the new nixos-router is a highlighted row in the
preview table. The update server section and the separate git update
are gone; bundles stay.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-25 11:49:57 +01:00

37 lines
1.1 KiB
Go

package main
import (
"os"
"path/filepath"
"strings"
)
// nixos-router is an input of the configuration flake like nixpkgs, and comes
// from a git repository whose tags vX.Y.Z are releases. Looking for it and
// locking it is router-upgrade's, with the packages (check.json has both). The
// repository is part of the installed version (routerUpdate.repository,
// written to /etc/router-update-repository), not something the page sets.
// repository is where releases come from ("" if the router has none).
func (s System) repository() string {
path := s.RepositoryFile
if path == "" {
path = "/etc/router-update-repository"
}
data, _ := os.ReadFile(path)
return strings.TrimSpace(string(data))
}
// newRouterVersion is the version of a release of nixos-router that is out and
// not installed, for the Overview ("" if there is none or nothing was checked).
func (a *app) newRouterVersion() string {
var c UpgradeCheck
if !readUpgradeFile(filepath.Join(a.sys.upgradeDir(), "check.json"), &c) {
return ""
}
if r := c.Router; r != nil && r.Newer && r.Installed == a.sys.installedRelease().Version {
return r.Newest.Version
}
return ""
}