Repository navigation
fix(init): converge the init script on startup, not only on self-update - #546
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #544.
The packaged init script already maps
netgrip.main.https/https_cert/https_keyto the-httpsflags, and the self-update flow already heals stale scripts (#492/#494). The gap:syncInitScriptonly 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:
ensureInitScript(reason, version)and addSyncInitScriptAtBoot, called frommainon every start, guarded by the presence of/etc/openwrt_releaseso dev machines and demo mode are never touched.Verification:
go build,go vetandgo 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-httpsand its UCI-configured certificate.