Compressed content type support for OTA


#1

Trying to use a compressed content type content1.tar.gz for downloading firmware updates to devices.

Steps to create:

  1. Create a local folder called ‘content’.

  2. Create a content.txt file in that directory with some random text.

  3. Run tar -zcvf content1.tar.gz content to compress. (Verified I could uncompress this before doing anything else)

  4. Use Murano Product UI to upload as new content, with ID ‘content1.tar.gz’. (I left MIME empty first, but tried multiple options here)

  5. Run curl command to try to download:
    curl -i 'https://<myproductid>.m2.exosite.io/provision/download?id=content1.tar.gz' -H 'X-Exosite-CIK: <tokenhere>' > content1.tar.gz

  6. Run tar -xvzf content1.tar.gz to uncompress.

The response is:

tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

Any thoughts would be appreciated.
Thanks
-Mike


#2

What does the file command tell you about the file you downloaded in step 5?

> file content1.tar.gz

#3
> file content1.tar.gz
content1.tar.gz: data

#4

Try opening content1.tar.gz with less and see what is in there. I think the -i flag is causing your problems. I’m guessing that you will see some HTTP headers followed by the binary data that is the actual file contents.


#5

Yep, here is beginning output from less command:

HTTP/1.1 200 OK
content-length: 2760
content-type: application/octet-stream
Accept-Ranges: bytes
date: Tue, 12 Sep 2017 11:48:40 GMT
server: Murano
transfer-encoding: chunked

^_<8B>^H^@^@<B2><B7>Y^@^C<ED> .....

#6

Thanks @tadpol
Removing ‘-i’ from the curl command did it. It might be good to review the example under http://docs.exosite.com/reference/products/device-api/http/#download-content to also show how to download the file to a local file or to make a note about using ‘-i’ here.

Part of the issue I also ran into was that I tried the Postman app to try the same thing and it could not get any response so I was under the assumption something was actually wrong with the file on the server - of course it turns out to be user error. (It was able to call the other download calls like get the list and get info).