#!/usr/bin/python3
"""Root reconciler for VolnOS Setup — runs on every boot via systemd.

After an OTA the rootfs is replaced, so the language pack and GPU driver the user
chose at first boot are gone. This re-installs them from the /data .deb cache (no
network needed) and re-asserts the system locale. Flatpaks live on /data and are
left untouched. A no-op if pre-install never ran or nothing is missing — so it is
cheap to run unconditionally at boot.
"""
import sys

sys.path.insert(0, "/usr/lib/volnos-preinstall")

from volnos_preinstall import provision  # noqa: E402


def main() -> int:
    try:
        provision.reconcile()
    except Exception as exc:  # noqa: BLE001 - never fail the boot
        sys.stderr.write(f"volnos-provision-reconcile: {exc}\n")
        return 0
    return 0


if __name__ == "__main__":
    sys.exit(main())
