timezoned: fix updating on /data/etc (#20119)

Co-authored-by: Comma Device <device@comma.ai>
pull/20120/head
Adeeb Shihadeh 2021-02-19 20:49:06 -08:00 committed by GitHub
parent 5557a6c6bd
commit 426a746a22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -21,9 +21,9 @@ def set_timezone(valid_timezones, timezone):
try:
if TICI:
tzpath = os.path.join("/usr/share/zoneinfo/", timezone)
os.symlink(tzpath, "/data/etc/localtime")
with open("/data/etc/timezone", "w") as f:
f.write(timezone)
subprocess.check_call(f'sudo su -c "ln -snf {tzpath} /data/etc/tmptime && \
mv /data/etc/tmptime /data/etc/localtime"', shell=True)
subprocess.check_call(f'sudo su -c "echo \"{timezone}\" > /data/etc/timezone"', shell=True)
else:
subprocess.check_call(f'sudo timedatectl set-timezone {timezone}', shell=True)
except subprocess.CalledProcessError: