Files
StarPilot/openpilot/starpilot/software/preferences.py
T
firestar5683 e66380e8fa Software and AGNOS
Manage software updates and AGNOS retained state through explicit manifests and update preferences.
2026-10-03 22:34:37 +00: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)