Skip to content

fix(init): converge the init script on startup, not only on self-update - #546

Merged
gnacho merged 1 commit into
mainfrom
fix/544-init-https-boot-sync
Oct 17, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/544-init-https-boot-sync

Conversation

@gnacho

@gnacho gnacho commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Closes #544.

The packaged init script already maps netgrip.main.https/https_cert/https_key to the -https flags, and the self-update flow already heals stale scripts (#492/#494). The gap: syncInitScript only ran during a self-update, so a device that only ever received manually copied binaries kept the pre-HTTPS init script forever and its UCI https toggle stayed a no-op. Found that exact state on a test router (UCI https=1 with a valid certificate, process running without -https, init script with zero mentions of https).

Changes:

  • Extract the sync logic into ensureInitScript(reason, version) and add SyncInitScriptAtBoot, called from main on every start, guarded by the presence of /etc/openwrt_release so dev machines and demo mode are never touched.
  • Same safety rules as the self-update path: a script without the managed marker is only rewritten when it byte-matches a known packaged variant; a customized script is left untouched. Versioned backup kept.

Verification: go build, go vet and go test ./... green (two new tests: startup heals a pristine legacy script; startup is a no-op off-router). Live on two routers: on a device with a legacy script the startup sync healed it (managed marker + https flags present, versioned backup created); on a device already running the canonical script the sync was a no-op (init md5 unchanged). After restarting the service the panel came up with -https and its UCI-configured certificate.

A device that only ever received manually copied binaries kept the
pre-HTTPS init script forever and its UCI https toggle stayed a no-op
(#544): the packaged script already maps netgrip.main.https to the
-https flags, but syncInitScript only ran before a self-update restart.
Run the same best-effort sync at startup (guarded by /etc/openwrt_release,
so dev machines and demo mode are never touched); the safety rules are
unchanged and a customized script is still left alone.

Closes #544
@gnacho
gnacho merged commit 2baff87 into main Oct 17, 2026
2 checks passed
@gnacho
gnacho deleted the fix/544-init-https-boot-sync branch October 17, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bridging: RSTP support via ustp

1 participant