update button fix
This commit is contained in:
parent
64f33c308b
commit
d07f7fa699
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
15
server.py
15
server.py
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user