aboutsummaryrefslogtreecommitdiff
path: root/scripts/update_program_manifest.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/update_program_manifest.js')
-rwxr-xr-xscripts/update_program_manifest.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/update_program_manifest.js b/scripts/update_program_manifest.js
new file mode 100755
index 00000000..9efc814f
--- /dev/null
+++ b/scripts/update_program_manifest.js
@@ -0,0 +1,39 @@
+#!/usr/bin/env node
+
+const fs = require("fs");
+const crypto = require("crypto");
+
+const [ _nodeExe, _jsPath, manifestFile, version, zipFile ] = process.argv;
+
+if (!manifestFile || !version || !zipFile) {
+ console.log(`Usage: update_program_manifest <manifest file> <version> <zip file>`);
+ console.log(`Adds a new latest version to the manifest file based on the ` +
+ `provided zip file.`);
+ process.exit(1);
+}
+
+if (!fs.existsSync(manifestFile)) {
+ console.error(`Manifest file '${manifestFile}' not found. Try again.`);
+ process.exit(2);
+}
+
+if (!fs.existsSync(zipFile)) {
+ console.error(`Zip file '${zipFile}' not found. Try again.`);
+ process.exit(2);
+}
+
+const manifest = JSON.parse(fs.readFileSync(manifestFile));
+
+manifest.versions = [{
+ version,
+ executable: "Attorney_Online.exe",
+ full: [
+ {
+ action: "dl",
+ url: "https://s3.wasabisys.com/ao-downloads/" + encodeURIComponent(zipFile),
+ hash: crypto.createHash("sha1").update(fs.readFileSync(zipFile)).digest("hex")
+ }
+ ]
+}, ...manifest.versions];
+
+fs.writeFileSync(manifestFile, JSON.stringify(manifest, null, 4)); \ No newline at end of file