Files
zigbee-OTA/scripts/updateall.js
David Beitey a45b49f4d0 Add sha512 checksum to OTA firmwares (#25)
* Add sha512 checksum to OTA firmwares

This hashes firmware during download and adds the hash to index.json.
Additionally, this PR adds `updateall.js` script which reads all
entries and runs `add.js` on each of them (for mass updates, such as the
hash algorithm or URL encoding etc).  To allow for this to happen, this
PR adds the ability to modify entries in-place via `add.js` (if called
on an existing path in the repo).

Lastly, this normalises the path for the Gledopto firmware to
lowercase its file extensions; they were previously `.OTA` in index.json
but `.ota` in the repository & in the `url` field -- something picked up
by the mass update.

* Update README.md

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2021-02-04 18:11:50 +01:00

16 lines
473 B
JavaScript

const child_process = require('child_process');
const fs = require('fs');
const path = require('path');
const main = async () => {
const indexJSON = JSON.parse(fs.readFileSync('index.json'));
indexJSON.forEach(entry => {
const result = child_process.execSync(`node ./scripts/add.js "${entry.path || entry.url}" "${entry.modelId || ''}"`, {
cwd: path.dirname(__dirname)
})
console.log(result.toString())
})
}
return main();