update button fix

This commit is contained in:
Neythen Treloar 2022-04-10 13:06:03 +01:00
parent 64f33c308b
commit d07f7fa699
2 changed files with 18 additions and 1 deletions

View File

@ -32,5 +32,9 @@ str=$(IFS=,; echo "${ar2[*]}")
rm csv/system_info.json rm csv/system_info.json
echo "$str" >> csv/system_info.json echo "$str" >> csv/system_info.json
echo "$str"
chmod 777 csv/system_info.json

View File

@ -64,9 +64,10 @@ f = open('csv/system_info.json', 'w')
try: try:
system_info = json.load(f) system_info = json.load(f)
except: except Exception as e:
system_info = {"update_available": False, "first_boot": False} system_info = {"update_available": False, "first_boot": False}
json.dump(system_info, f) json.dump(system_info, f)
f.close() f.close()
ticker.sendline('*') # run startup gif by default ticker.sendline('*') # run startup gif by default
@ -320,6 +321,18 @@ def stop():
@app.route("/update", methods=['PUT','POST']) @app.route("/update", methods=['PUT','POST'])
def update(): def update():
f = open('csv/system_info.json', 'w+')
try:
system_info = json.load(f)
except Exception as e:
system_info = {"update_available": False, "first_boot": False}
system_info['update_available'] = False
json.dump(system_info, f)
f.close()
os.system("./update.sh") os.system("./update.sh")
os.system("sudo reboot now") os.system("sudo reboot now")
return index() return index()