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

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 426a746a22
commatwo_master
Adeeb Shihadeh 4 years ago committed by GitHub
parent 6806378e60
commit 5b3b482bd9
  1. 6
      selfdrive/timezoned.py

@ -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:

Loading…
Cancel
Save