From 3bc7e206c3f75e7c6b9092980910763e86823983 Mon Sep 17 00:00:00 2001 From: Ryan Sturmer Date: Tue, 24 Oct 2017 10:05:46 -0400 Subject: [PATCH] Add consolidated build script --- .gitignore | 10 ++++ scripts/consolidated/Makefile | 47 ++++++++++++++++++ scripts/consolidated/fetch.js | 45 +++++++++++++++++ scripts/consolidated/files/consolidated.json | 49 +++++++++++++++++++ scripts/consolidated/files/container.json | 36 ++++++++++++++ .../files/fabmo-temp-updater.service | 10 ++++ scripts/consolidated/files/server.js | 33 +++++++++++++ 7 files changed, 230 insertions(+) create mode 100644 scripts/consolidated/Makefile create mode 100644 scripts/consolidated/fetch.js create mode 100644 scripts/consolidated/files/consolidated.json create mode 100644 scripts/consolidated/files/container.json create mode 100644 scripts/consolidated/files/fabmo-temp-updater.service create mode 100644 scripts/consolidated/files/server.js diff --git a/.gitignore b/.gitignore index 47a5556..6edcc12 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,13 @@ node_modules *.tmp *~ *.swp + +scripts/consolidated/tmp +scripts/consolidated/dl +scripts/consolidated/build +scripts/consolidated/*.tar.gz +scripts/consolidated/*.bin +scripts/consolidated/*.json + + + diff --git a/scripts/consolidated/Makefile b/scripts/consolidated/Makefile new file mode 100644 index 0000000..b63b9fe --- /dev/null +++ b/scripts/consolidated/Makefile @@ -0,0 +1,47 @@ +build/container.fmp: cleartmp build/consolidated.fmp + cd tmp; \ + cp ../files/container.json ./manifest.json; \ + cp ../files/server.js ../build/consolidated.fmp ../files/fabmo-temp-updater.service .; \ + tar -cvzf updater-stub.tar.gz server.js; \ + tar -cvzf consolidated.tar.gz consolidated.fmp; \ + tar -cvzf service.tar.gz fabmo-temp-updater.service; \ + tar -cvzf ../build/container.fmp updater-stub.tar.gz manifest.json consolidated.tar.gz service.tar.gz + +dl/engine.fmp dl/updater.fmp: + mkdir -p dl + node fetch.js + +engine.tar.gz: cleartmp dl/engine.fmp + cd tmp; \ + tar -xvzf ../dl/engine.fmp; \ + mv files.tar.gz ../engine.tar.gz ;\ + mv g2.bin ../ + +updater.tar.gz: cleartmp dl/updater.fmp + cd tmp; \ + tar -xvzf ../dl/updater.fmp; \ + mv files.tar.gz ../updater.tar.gz + +token.tar.gz: cleartmp + cd tmp; \ + touch install_token; \ + tar -cvzf token.tar.gz install_token; \ + mv token.tar.gz .. + +build/consolidated.fmp: cleartmp token.tar.gz updater.tar.gz engine.tar.gz g2.bin files/consolidated.json + mkdir -p build + cd tmp; \ + cp ../engine.tar.gz .; \ + cp ../updater.tar.gz .; \ + cp ../token.tar.gz .; \ + cp ../g2.bin .; \ + cp ../files/consolidated.json ./manifest.json; \ + tar -cvzf ../build/consolidated.fmp engine.tar.gz updater.tar.gz g2.bin manifest.json + +cleartmp: + mkdir -p tmp + rm -rf tmp/* + +clean: + rm -rf tmp dl engine.tar.gz updater.tar.gz token.tar.gz g2.bin build +.PHONY: cleartemp clean diff --git a/scripts/consolidated/fetch.js b/scripts/consolidated/fetch.js new file mode 100644 index 0000000..38dedfb --- /dev/null +++ b/scripts/consolidated/fetch.js @@ -0,0 +1,45 @@ +var request = require('request') +var fs = require('fs') + +var MANIFEST_URL = 'http://fabmo.github.io/manifest/packages-rc.json' +var engineURL = null; +var updaterURL = null; +//var filesDownloaded = 0; + +request(MANIFEST_URL, { json: true }, function(err, res, body) { + packages = body['packages'] + for(var i=0; i