Update from a git repository

router.update.repository names a public repository whose tags vX.Y.Z are
releases. router-update check (daily, and from the Updates page) looks for a
newer one and the Overview says so; router-update --git builds the router
from a tag like a bundle update: the settings are migrated, the new version
must be confirmed, the nixpkgs pin stays. The flake of such a router comes
from the release's config-flake.nix. The global flake registry is off.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 08:57:00 +01:00
co-authored by Claude Sonnet 5.5
parent a2dbeb5dea
commit 3fc54e678e
13 changed files with 589 additions and 26 deletions
+7 -4
View File
@@ -93,7 +93,10 @@ func (s Settings) channel() string { return str(s, "router", "update", "channel"
// setChannel changes router.update.channel in settings.json and, since it takes
// effect when upgrading rather than when applying, in the confirmed settings
// too, so it does not show up as an unapplied change.
func (sys System) setChannel(channel string) error {
func (sys System) setChannel(channel string) error { return sys.setUpdateField("channel", channel) }
// setUpdateField does that for a key of router.update ("" removes it).
func (sys System) setUpdateField(key, value string) error {
set := func(path string, required bool) error {
s, err := loadSettings(path)
if err != nil {
@@ -103,15 +106,15 @@ func (sys System) setChannel(channel string) error {
return err
}
router := obj(s, "router")
if channel == "" {
if value == "" {
if u, ok := router["update"].(map[string]any); ok {
delete(u, "channel")
delete(u, key)
if len(u) == 0 {
delete(router, "update")
}
}
} else {
obj(router, "update")["channel"] = channel
obj(router, "update")[key] = value
}
return s.save(path)
}