Migrate legacy USER schema to MLAT_USER+MLAT_ENABLED on save#3
Merged
Conversation
Adds helpers/migrate-config.sh which translates the legacy USER= key in /boot/airplanes-config.txt into the split MLAT_USER + MLAT_ENABLED schema expected by the new feed daemons. The migrator runs once on install and after every PHP save through install-adsbconfig.sh. install-adsbconfig.sh and restart-services.sh share a flock so a service restart can never read a half-migrated file. USER is preserved in normalized quoted form so existing legacy consumers continue to work. Migration is idempotent (byte-compares before rewriting), atomic (temp + mv), parses without sourcing user-supplied content, and writes a one-time .pre-mlat-split backup. Includes a bash test suite covering 14 cases.
This was referenced May 10, 2026
Empty USER previously translated to MLAT_USER="" + MLAT_ENABLED=true, which trips the daemon's strict-fail on empty MLAT_USER. Feed's configure.sh and apl-feed mlat enable already default to Anonymous; the migrator is itself a writer and should produce the same valid output.
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.
Adds a migrator script that translates the legacy single-key USER= form in airplanes-config.txt into the split MLAT_USER + MLAT_ENABLED keys expected by newer feed daemons. The migrator runs once at install time and after every PHP-driven save (through install-adsbconfig.sh). install-adsbconfig.sh and restart-services.sh share a flock so a service restart can never read a partially-written or half-migrated file.
USER is preserved in normalized quoted form alongside the new keys, so existing legacy daemons and helpers that still key off USER keep working. Migration is idempotent (byte-compares before rewriting, so mtime stays put on no-op re-runs), atomic (temp + mv), parses without sourcing user content, and writes a one-time .pre-mlat-split backup. Covered by a 14-case bash test suite that's wired into the existing CI shellcheck + tests job.