Skip to content

Migrate legacy USER schema to MLAT_USER+MLAT_ENABLED on save#3

Merged
d4rken merged 2 commits into
devfrom
feat/mlat-user-schema-migration
May 11, 2026
Merged

Migrate legacy USER schema to MLAT_USER+MLAT_ENABLED on save#3
d4rken merged 2 commits into
devfrom
feat/mlat-user-schema-migration

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented May 10, 2026

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.

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.
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.
@d4rken d4rken merged commit b35aa3f into dev May 11, 2026
1 check passed
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.

1 participant