Skip to content

Commit e31eff3

Browse files
committed
Clean update artifacts, launch coderbot_update on the uploaded file, then reboot
1 parent 6b30566 commit e31eff3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ def resetDefaultPrograms():
177177
q = p.read()
178178
programs.insert(json.loads(q))
179179

180-
def uploadFile():
180+
def updateFromPackage():
181+
os.system('sudo bash /home/pi/clean-update.sh')
181182
file_to_upload = connexion.request.files['file_to_upload']
182-
file_to_upload.save(os.path.join('updatePackages', file_to_upload.filename))
183-
os.system('sudo coderbot_update updatePackages/' + file_to_upload.filename)
183+
file_to_upload.save(os.path.join('/home/pi/', 'update.tar'))
184+
os.system('sudo coderbot_update /home/pi/update.tar && sudo reboot')
184185
return 200

v2.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ paths:
7474
description: "ok"
7575
400:
7676
description: "Failed to save the activity"
77-
/uploadFile:
77+
/updateFromPackage:
7878
post:
79-
operationId: "api.uploadFile"
79+
operationId: "api.updateFromPackage"
8080
consumes:
8181
- multipart/form-data
8282
parameters:

0 commit comments

Comments
 (0)