Command line software update support.
This Python script uploads the software image to the system and then waits for the notification of success or failure of the flash process.
$ ./software_update.py -h
usage: software_update.py [-h] path ip timeout
positional arguments:
path
ip
timeout
optional arguments:
-h, --help show this help message and exit
The software update process will take several minutes.
$ python3 ./software_update.py image.swu 10.0.2.1 600
Start uploading image...
Software image uploaded successfully. Wait for installation to be finished...
Wait update finished
Software update successful !
The HTTP upload API can also be used directly with curl
. In this case only the
software image is uploaded and a response about success or failure of the flash
process is not waited or checked.
curl -v -F [email protected] http://10.0.2.1/update/upload
* Trying 10.0.2.1:8080...
* TCP_NODELAY set
* Connected to 10.0.2.1 (10.0.2.1) port 80 (#0)
> POST /update/upload HTTP/1.1
> Host: 10.0.2.1
> User-Agent: curl/7.66.0
> Accept: */*
> Content-Length: 435603202
> Content-Type: multipart/form-data; boundary=------------------------5ee14ea9339300b5
> Expect: 100-continue
>
* Done waiting for 100-continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: Mongoose/6.18
< Content-Type: text/plain
< Connection: close
<
Ok, image.swu - 435602944 bytes.
curl -v -F [email protected] http://10.0.2.1:8080/upload
* Trying 10.0.2.1:8080...
* TCP_NODELAY set
* Connected to 10.0.2.1 (10.0.2.1) port 8080 (#0)
> POST /upload HTTP/1.1
> Host: 10.0.2.1:8080
> User-Agent: curl/7.66.0
> Accept: */*
> Content-Length: 435603202
> Content-Type: multipart/form-data; boundary=------------------------5ee14ea9339300b5
> Expect: 100-continue
>
* Done waiting for 100-continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: Mongoose/6.18
< Content-Type: text/plain
< Connection: close
<
Ok, image.swu - 435602944 bytes.
software_update.py is licensed under GNU General Public License v3.0 or later
- see the LICENSE file for details