check update added

This commit is contained in:
Neythen Treloar 2022-02-27 09:52:37 +00:00
parent 21f28e0977
commit dfe068591a
3 changed files with 17 additions and 5 deletions

2
csv/system_info.json Executable file → Normal file
View File

@ -1 +1 @@
{"update_available": false, "first_boot": true} {"update_available": false, "first_boot": false}

View File

@ -26,7 +26,7 @@ import urllib.request
#open('log.txt', 'w').close() #wipe logs #open('log.txt', 'w').close() #wipe logs
os.system("sudo ./check_update.sh")
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py") #api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py") api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
api_caller.sendline('A') api_caller.sendline('A')
@ -121,6 +121,7 @@ def index():
templateData = { templateData = {
'system_info':system_info,
'currently_displaying': currently_displaying, 'currently_displaying': currently_displaying,
'not_displaying': not_displaying, 'not_displaying': not_displaying,
'stocks_settings': stocks_settings, 'stocks_settings': stocks_settings,
@ -235,8 +236,13 @@ def stop():
@app.route("/update", methods=['PUT','POST']) @app.route("/update", methods=['PUT','POST'])
def update(): def update():
os.system("./update.sh") uptodate = os.system('sudo ./check_update.sh')
os.system("sudo reboot now") print('python:', uptodate)
print(uptodate == 'not up to date')
print(uptodate == 'up to date')
#os.system("./update.sh")
#os.system("sudo reboot now")
return index() return index()
@app.route("/restart") @app.route("/restart")

View File

@ -52,7 +52,13 @@
</p> </p>
</div> </div>
<div class=""> <div class="">
<button id="update-btn" class="btn btn-secondary">Check Updates</button> <button id="update-btn" class="btn btn-secondary">
{% if system_info.update_available %}
Update available!
{%else%}
Up to date
{%endif%}
</button>
</div> </div>
</div> </div>
</nav> </nav>