mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-28 17:13:54 +08:00
0db0d2f589
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>
20 lines
671 B
Python
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)
|