pull/35960/head
Maxime Desroches 1 month ago
parent 8e8145de69
commit 3b7f689b3c
  1. 10
      system/ui/setup.py

@ -5,6 +5,8 @@ import threading
import time import time
import urllib.request import urllib.request
from enum import IntEnum from enum import IntEnum
import shutil
import pyray as rl import pyray as rl
from cereal import log from cereal import log
@ -31,6 +33,10 @@ USER_AGENT = f"AGNOSSetup-{HARDWARE.get_os_version()}"
OPENPILOT_CACHE_PATH = "/data/openpilot.cache" OPENPILOT_CACHE_PATH = "/data/openpilot.cache"
INSTALLER_SOURCE_PATH = "/usr/comma/installer"
INSTALLER_DESTINATION_PATH = "/tmp/installer"
INSTALLER_URL_PATH = "/tmp/installer_url"
class SetupState(IntEnum): class SetupState(IntEnum):
LOW_VOLTAGE = 0 LOW_VOLTAGE = 0
@ -303,6 +309,10 @@ class Setup(Widget):
def use_openpilot(self): def use_openpilot(self):
if os.path.isdir(OPENPILOT_CACHE_PATH): if os.path.isdir(OPENPILOT_CACHE_PATH):
shutil.copyfile(INSTALLER_SOURCE_PATH, INSTALLER_DESTINATION_PATH)
os.chmod(INSTALLER_DESTINATION_PATH, 0o755)
with open(INSTALLER_URL_PATH, "w") as f:
f.write(OPENPILOT_URL)
gui_app.request_close() gui_app.request_close()
else: else:
self.state = SetupState.NETWORK_SETUP self.state = SetupState.NETWORK_SETUP

Loading…
Cancel
Save