Files
StarPilot/openpilot/starpilot/software/preferences.py
firestar5683 0db0d2f589 Software and AGNOS
Manage software updates and AGNOS retained state through explicit manifests and update preferences.

Co-authored-by: Daniel Koepping <elkoled@gmail.com>
Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>

Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com>
2026-10-14 20:02:39 -05:00

20 lines
671 B
Python

"""Automatic download preference; manual updater requests remain independent."""
from openpilot.starpilot.saved_source import read_saved
AUTOMATIC_DOWNLOADS = 'UpdaterAutomaticDownloads'
def automatic_downloads(params) -> bool | None:
try:
raw, readable = read_saved(params, AUTOMATIC_DOWNLOADS, 1)
except (OSError, KeyError, ValueError):
return None
if not readable or raw not in (None, b'0', b'1'):
return None
return raw != b'0' # Preserve the upstream schedule for existing installations.
def download_permitted(params, *, manual: bool, check_only: bool) -> bool:
return not check_only and (manual or automatic_downloads(params) is True)