updated: add persistent param for build date (#22237)

pull/22242/head
Adeeb Shihadeh 2021-09-14 20:24:41 -07:00 committed by GitHub
parent b670868bcd
commit ed70c5aaf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -153,8 +153,9 @@ std::unordered_map<std::string, uint32_t> keys = {
{"GsmRoaming", PERSISTENT},
{"HardwareSerial", PERSISTENT},
{"HasAcceptedTerms", PERSISTENT},
{"IsDriverViewEnabled", CLEAR_ON_MANAGER_START},
{"IMEI", PERSISTENT},
{"InstallDate", PERSISTENT},
{"IsDriverViewEnabled", CLEAR_ON_MANAGER_START},
{"IsLdwEnabled", PERSISTENT},
{"IsMetric", PERSISTENT},
{"IsOffroad", CLEAR_ON_MANAGER_START},

View File

@ -346,6 +346,12 @@ def main():
if EON and os.geteuid() != 0:
raise RuntimeError("updated must be launched as root!")
ov_lock_fd = open(LOCK_FILE, 'w')
try:
fcntl.flock(ov_lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError as e:
raise RuntimeError("couldn't get overlay lock; is another updated running?") from e
# Set low io priority
proc = psutil.Process()
if psutil.LINUX:
@ -355,11 +361,9 @@ def main():
if Path(os.path.join(STAGING_ROOT, "old_openpilot")).is_dir():
cloudlog.event("update installed")
ov_lock_fd = open(LOCK_FILE, 'w')
try:
fcntl.flock(ov_lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError as e:
raise RuntimeError("couldn't get overlay lock; is another updated running?") from e
if not params.get("InstallDate"):
t = datetime.datetime.utcnow().isoformat()
params.put("InstallDate", t.encode('utf8'))
# Wait for IsOffroad to be set before our first update attempt
wait_helper = WaitTimeHelper(proc)