From 3855bb4d56ac57a2309f47da74217f55d049d281 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 24 Sep 2018 14:10:20 +0100 Subject: [PATCH] Use Resin CI scripts to build Etcher Change-type: patch Signed-off-by: Juan Cruz Viotti --- .gitmodules | 3 + Makefile | 473 +++--------------- npm-shrinkwrap.json | 166 +++--- scripts/build/architecture-convert.sh | 119 ----- scripts/build/check-dependency.sh | 52 -- .../build/dependencies-npm-extract-addons.sh | 62 --- scripts/build/dependencies-npm.sh | 144 ------ scripts/build/docker/Dockerfile-armv7hf | 61 --- scripts/build/docker/Dockerfile-i686 | 75 --- scripts/build/docker/Dockerfile-x86_64 | 74 --- scripts/build/docker/Dockerfile.template | 79 --- scripts/build/docker/README.md | 57 --- scripts/build/docker/compile-template.js | 48 -- scripts/build/download-tool.sh | 94 ---- scripts/build/electron-brand-exe-win32.sh | 90 ---- scripts/build/electron-brand-exe.sh | 90 ---- scripts/build/electron-create-appdir.sh | 109 ---- .../build/electron-create-appimage-linux.sh | 85 ---- scripts/build/electron-sign-exe-win32.sh | 74 --- scripts/build/electron-sign-file-darwin.sh | 56 --- scripts/build/platform-convert.sh | 67 --- scripts/build/tar-gz-file.sh | 52 -- scripts/build/zip-file.sh | 69 --- scripts/ci/build-installers.sh | 56 --- scripts/ci/deploy.sh | 56 --- ...re-all-file-extensions-in-gitattributes.sh | 4 - .../ensure-npm-dependencies-compatibility.sh | 4 - scripts/ci/ensure-npm-shrinkwrap-versions.sh | 46 -- scripts/ci/ensure-npm-valid-dependencies.sh | 25 - scripts/ci/ensure-staged-shrinkwrap.sh | 36 -- scripts/ci/install.sh | 79 --- scripts/ci/test.sh | 56 --- .../run-command.sh => docker-run-command.sh} | 24 +- scripts/publish/aws-s3.sh | 80 --- scripts/publish/bintray.sh | 107 ---- scripts/resin | 1 + 36 files changed, 157 insertions(+), 2616 deletions(-) create mode 100644 .gitmodules delete mode 100755 scripts/build/architecture-convert.sh delete mode 100755 scripts/build/check-dependency.sh delete mode 100755 scripts/build/dependencies-npm-extract-addons.sh delete mode 100755 scripts/build/dependencies-npm.sh delete mode 100644 scripts/build/docker/Dockerfile-armv7hf delete mode 100644 scripts/build/docker/Dockerfile-i686 delete mode 100644 scripts/build/docker/Dockerfile-x86_64 delete mode 100644 scripts/build/docker/Dockerfile.template delete mode 100644 scripts/build/docker/README.md delete mode 100644 scripts/build/docker/compile-template.js delete mode 100755 scripts/build/download-tool.sh delete mode 100644 scripts/build/electron-brand-exe-win32.sh delete mode 100755 scripts/build/electron-brand-exe.sh delete mode 100755 scripts/build/electron-create-appdir.sh delete mode 100755 scripts/build/electron-create-appimage-linux.sh delete mode 100755 scripts/build/electron-sign-exe-win32.sh delete mode 100755 scripts/build/electron-sign-file-darwin.sh delete mode 100755 scripts/build/platform-convert.sh delete mode 100755 scripts/build/tar-gz-file.sh delete mode 100755 scripts/build/zip-file.sh delete mode 100755 scripts/ci/build-installers.sh delete mode 100755 scripts/ci/deploy.sh delete mode 100755 scripts/ci/ensure-npm-shrinkwrap-versions.sh delete mode 100755 scripts/ci/ensure-npm-valid-dependencies.sh delete mode 100755 scripts/ci/ensure-staged-shrinkwrap.sh delete mode 100755 scripts/ci/install.sh delete mode 100755 scripts/ci/test.sh rename scripts/{build/docker/run-command.sh => docker-run-command.sh} (76%) delete mode 100755 scripts/publish/aws-s3.sh delete mode 100755 scripts/publish/bintray.sh create mode 160000 scripts/resin diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e313652c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "scripts/resin"] + path = scripts/resin + url = git@github.com:resin-io/scripts.git diff --git a/Makefile b/Makefile index 19fad1f3..7632db9f 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,8 @@ # Build configuration # --------------------------------------------------------------------- -# A non-existing target to force rules to rebuild -# See https://stackoverflow.com/a/816416 -.FORCE: +RESIN_SCRIPTS ?= ./scripts/resin +S3_BUCKET = artifacts.ci.balena-cloud.com # This directory will be completely deleted by the `clean` rule BUILD_DIRECTORY ?= dist @@ -17,8 +16,11 @@ endif BUILD_TEMPORARY_DIRECTORY = $(BUILD_DIRECTORY)/.tmp -# See https://github.com/electron/spectron/issues/127 -ETCHER_SPECTRON_ENTRYPOINT ?= $(shell node -e 'console.log(require("electron"))') +$(BUILD_DIRECTORY): + mkdir $@ + +$(BUILD_TEMPORARY_DIRECTORY): | $(BUILD_DIRECTORY) + mkdir $@ # See https://stackoverflow.com/a/13468229/1641422 SHELL := /bin/bash @@ -75,10 +77,10 @@ else endif ifndef PLATFORM -$(error We couldn't detect your host platform) +$(error We could not detect your host platform) endif ifndef HOST_ARCH -$(error We couldn't detect your host architecture) +$(error We could not detect your host architecture) endif # Default to host architecture. You can override by doing: @@ -87,289 +89,60 @@ endif # TARGET_ARCH ?= $(HOST_ARCH) -# Support x86 builds from x64 in GNU/Linux -# See https://github.com/addaleax/lzma-native/issues/27 -ifeq ($(PLATFORM),linux) - ifneq ($(HOST_ARCH),$(TARGET_ARCH)) - ifeq ($(TARGET_ARCH),x86) - export CFLAGS += -m32 - else -$(error Can't build $(TARGET_ARCH) binaries on a $(HOST_ARCH) host) - endif - endif -endif - # --------------------------------------------------------------------- -# Application configuration +# Electron # --------------------------------------------------------------------- -ELECTRON_VERSION = $(shell jq -r '.devDependencies["electron"]' package.json) -NODE_VERSION = 6.1.0 -COMPANY_NAME = Resinio Ltd -APPLICATION_NAME = $(shell jq -r '.displayName' package.json) -APPLICATION_DESCRIPTION = $(shell jq -r '.description' package.json) -APPLICATION_COPYRIGHT = $(shell cat electron-builder.yml | shyaml get-value copyright) +electron-develop: | $(BUILD_TEMPORARY_DIRECTORY) + $(RESIN_SCRIPTS)/electron/install.sh \ + -b $(shell pwd) \ + -r $(TARGET_ARCH) \ + -s $(PLATFORM) \ + -n $(BUILD_TEMPORARY_DIRECTORY)/npm \ + -a $(S3_BUCKET) -BINTRAY_ORGANIZATION = etcher -BINTRAY_REPOSITORY_DEBIAN = debian -BINTRAY_REPOSITORY_REDHAT = redhat +electron-test: + $(RESIN_SCRIPTS)/electron/test.sh \ + -b $(shell pwd) \ + -s $(PLATFORM) -# --------------------------------------------------------------------- -# Extra variables -# --------------------------------------------------------------------- +assets/dmg/background.tiff: assets/dmg/background.png assets/dmg/background@2x.png + tiffutil -cathidpicheck $^ -out $@ -TARGET_ARCH_DEBIAN = $(shell ./scripts/build/architecture-convert.sh -r $(TARGET_ARCH) -t debian) -TARGET_ARCH_REDHAT = $(shell ./scripts/build/architecture-convert.sh -r $(TARGET_ARCH) -t redhat) -TARGET_ARCH_APPIMAGE = $(shell ./scripts/build/architecture-convert.sh -r $(TARGET_ARCH) -t appimage) -TARGET_ARCH_ELECTRON_BUILDER = $(shell ./scripts/build/architecture-convert.sh -r $(TARGET_ARCH) -t electron-builder) -PLATFORM_PKG = $(shell ./scripts/build/platform-convert.sh -r $(PLATFORM) -t pkg) -ENTRY_POINT_CLI = lib/cli/etcher.js -ETCHER_CLI_BINARY = $(APPLICATION_NAME_LOWERCASE) -ifeq ($(PLATFORM),win32) -ETCHER_CLI_BINARY = $(APPLICATION_NAME_LOWERCASE).exe -endif - -APPLICATION_NAME_LOWERCASE = $(shell echo $(APPLICATION_NAME) | tr A-Z a-z) -APPLICATION_VERSION_DEBIAN = $(shell echo $(APPLICATION_VERSION) | tr "-" "~") -APPLICATION_VERSION_REDHAT = $(APPLICATION_VERSION) - -# --------------------------------------------------------------------- -# Release type -# --------------------------------------------------------------------- - -# Add the current commit to the version if release type is "snapshot" -RELEASE_TYPE ?= snapshot -PACKAGE_JSON_VERSION = $(shell jq -r '.version' package.json) -ifeq ($(RELEASE_TYPE),production) -APPLICATION_VERSION = $(PACKAGE_JSON_VERSION) -S3_BUCKET = resin-production-downloads -BINTRAY_COMPONENT = $(APPLICATION_NAME_LOWERCASE) -endif -ifeq ($(RELEASE_TYPE),snapshot) -CURRENT_COMMIT_HASH = $(shell git log -1 --format="%h") -APPLICATION_VERSION = $(PACKAGE_JSON_VERSION)+$(CURRENT_COMMIT_HASH) -S3_BUCKET = resin-nightly-downloads -BINTRAY_COMPONENT = $(APPLICATION_NAME_LOWERCASE)-devel -endif -ifndef APPLICATION_VERSION -$(error Invalid release type: $(RELEASE_TYPE)) -endif - -# --------------------------------------------------------------------- -# Code signing -# --------------------------------------------------------------------- - -ifeq ($(PLATFORM),darwin) -ifndef CSC_NAME -$(warning No code-sign identity found (CSC_NAME is not set)) -endif -endif - -ifeq ($(PLATFORM),win32) -ifndef CSC_LINK -$(warning No code-sign certificate found (CSC_LINK is not set)) -ifndef CSC_KEY_PASSWORD -$(warning No code-sign certificate password found (CSC_KEY_PASSWORD is not set)) -endif -endif -endif - -# --------------------------------------------------------------------- -# Electron Builder -# --------------------------------------------------------------------- - -ELECTRON_BUILDER_OPTIONS = --$(TARGET_ARCH_ELECTRON_BUILDER) - -# --------------------------------------------------------------------- -# Analytics -# --------------------------------------------------------------------- - -ifndef ANALYTICS_SENTRY_TOKEN -$(warning No Sentry token found (ANALYTICS_SENTRY_TOKEN is not set)) -else -ELECTRON_BUILDER_OPTIONS += --extraMetadata.analytics.sentry.token=$(ANALYTICS_SENTRY_TOKEN) -endif - -ifndef ANALYTICS_MIXPANEL_TOKEN -$(warning No Mixpanel token found (ANALYTICS_MIXPANEL_TOKEN is not set)) -else -ELECTRON_BUILDER_OPTIONS += --extraMetadata.analytics.mixpanel.token=$(ANALYTICS_MIXPANEL_TOKEN) -endif - -# --------------------------------------------------------------------- -# Rules -# --------------------------------------------------------------------- - -# See http://stackoverflow.com/a/12528721 -# Note that the blank line before 'endef' is actually important - don't delete it -define execute-command - $(1) - -endef - -$(BUILD_DIRECTORY): - mkdir $@ - -$(BUILD_TEMPORARY_DIRECTORY): | $(BUILD_DIRECTORY) - mkdir $@ +electron-build: assets/dmg/background.tiff | $(BUILD_TEMPORARY_DIRECTORY) + $(RESIN_SCRIPTS)/electron/build.sh \ + -b $(shell pwd) \ + -r $(TARGET_ARCH) \ + -s $(PLATFORM) \ + -v production \ + -n $(BUILD_TEMPORARY_DIRECTORY)/npm \ + -w $(BUILD_TEMPORARY_DIRECTORY) # --------------------------------------------------------------------- # CLI # --------------------------------------------------------------------- -$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH)-app: \ - package.json npm-shrinkwrap.json \ - | $(BUILD_DIRECTORY) - mkdir -p $@ - ./scripts/build/dependencies-npm.sh -p \ - -r "$(TARGET_ARCH)" \ - -v "$(NODE_VERSION)" \ - -x $@ \ - -t node \ - -s "$(PLATFORM)" - patch --directory=$@ --force --strip=1 --ignore-whitespace < patches/lzma-native-index-static-addon-require.patch - cp -r lib $@ - cp package.json $@ - -$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH): \ - $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH)-app \ - | $(BUILD_DIRECTORY) - mkdir $@ - cd $< && pkg --output ../../$@/$(ETCHER_CLI_BINARY) -t node6-$(PLATFORM_PKG)-$(TARGET_ARCH) $(ENTRY_POINT_CLI) - ./scripts/build/dependencies-npm-extract-addons.sh \ - -d $ lib/gui/css/main.css lint-js: - eslint lib tests scripts bin versionist.conf.js webpack.config.js + eslint --ignore-pattern scripts/resin/**/*.js lib tests scripts bin versionist.conf.js webpack.config.js lint-sass: sass-lint lib/gui/scss @@ -560,6 +208,8 @@ lint: lint-js lint-sass lint-cpp lint-html lint-spell MOCHA_OPTIONS=--recursive --reporter spec +# See https://github.com/electron/spectron/issues/127 +ETCHER_SPECTRON_ENTRYPOINT ?= $(shell node -e 'console.log(require("electron"))') test-spectron: ETCHER_SPECTRON_ENTRYPOINT="$(ETCHER_SPECTRON_ENTRYPOINT)" mocha $(MOCHA_OPTIONS) tests/spectron @@ -582,18 +232,13 @@ help: @echo "Available targets: $(TARGETS)" info: - @echo "Application version : $(APPLICATION_VERSION)" - @echo "Release type : $(RELEASE_TYPE)" @echo "Platform : $(PLATFORM)" @echo "Host arch : $(HOST_ARCH)" @echo "Target arch : $(TARGET_ARCH)" sanity-checks: ./scripts/ci/ensure-staged-sass.sh - ./scripts/ci/ensure-staged-shrinkwrap.sh ./scripts/ci/ensure-npm-dependencies-compatibility.sh - ./scripts/ci/ensure-npm-valid-dependencies.sh - ./scripts/ci/ensure-npm-shrinkwrap-versions.sh ./scripts/ci/ensure-all-file-extensions-in-gitattributes.sh clean: @@ -602,6 +247,8 @@ clean: distclean: clean rm -rf node_modules rm -rf build + rm -rf dist rm -rf generated + rm -rf $(BUILD_TEMPORARY_DIRECTORY) .DEFAULT_GOAL = help diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f1e9143f..c17b9d93 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -2,6 +2,16 @@ "name": "etcher", "version": "1.4.5", "dependencies": { + "@babel/runtime": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.1.2.tgz", + "dependencies": { + "regenerator-runtime": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz" + } + } + }, "@fortawesome/fontawesome-free-webfonts": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free-webfonts/-/fontawesome-free-webfonts-1.0.9.tgz" @@ -11,8 +21,8 @@ "resolved": "https://registry.npmjs.org/@types/angular/-/angular-1.6.51.tgz" }, "@types/chart.js": { - "version": "2.7.37", - "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.7.37.tgz" + "version": "2.7.40", + "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.7.40.tgz" }, "@types/color": { "version": "2.0.1", @@ -47,8 +57,8 @@ "resolved": "https://registry.npmjs.org/@types/lodash.memoize/-/lodash.memoize-4.1.4.tgz" }, "@types/node": { - "version": "10.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.6.tgz" + "version": "10.12.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.0.tgz" }, "@types/prop-types": { "version": "15.5.6", @@ -586,8 +596,8 @@ "dev": true }, "ast-types": { - "version": "0.11.5", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.11.5.tgz", + "version": "0.11.6", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.11.6.tgz", "dev": true }, "async": { @@ -1025,8 +1035,8 @@ "dev": true, "dependencies": { "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true } } @@ -1149,8 +1159,7 @@ }, "bcrypt-pbkdf": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "optional": true + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz" }, "big.js": { "version": "3.2.0", @@ -1417,8 +1426,8 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true }, "source-map": { @@ -1491,8 +1500,8 @@ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz" }, "caniuse-lite": { - "version": "1.0.30000890", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000890.tgz", + "version": "1.0.30000893", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000893.tgz", "dev": true }, "capture-stack-trace": { @@ -1568,8 +1577,8 @@ "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz" }, "chart.js": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.7.2.tgz" + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.7.3.tgz" }, "chartjs-color": { "version": "2.2.0", @@ -1687,8 +1696,8 @@ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz" }, "styled-system": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/styled-system/-/styled-system-3.1.6.tgz" + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/styled-system/-/styled-system-3.1.11.tgz" } } }, @@ -2263,8 +2272,7 @@ }, "ecc-jsbn": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "optional": true + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz" }, "ejs": { "version": "2.6.1", @@ -2349,8 +2357,8 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true }, "string-width": { @@ -2413,8 +2421,8 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true }, "sumchecker": { @@ -2447,8 +2455,8 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true } } @@ -2529,8 +2537,8 @@ } }, "electron-to-chromium": { - "version": "1.3.75", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.75.tgz", + "version": "1.3.80", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.80.tgz", "dev": true }, "electron-window": { @@ -2716,8 +2724,8 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true }, "strip-ansi": { @@ -2829,8 +2837,8 @@ "dev": true, "dependencies": { "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true } } @@ -3418,8 +3426,8 @@ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz" }, "styled-system": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/styled-system/-/styled-system-3.1.6.tgz" + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/styled-system/-/styled-system-3.1.11.tgz" } } }, @@ -4107,8 +4115,7 @@ }, "jsbn": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "optional": true + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz" }, "jsesc": { "version": "1.3.0", @@ -5030,8 +5037,8 @@ } }, "minizlib": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.1.tgz" }, "mixin-deep": { "version": "1.3.1", @@ -5223,8 +5230,8 @@ } }, "neo-async": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.2.tgz", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz", "dev": true }, "netmask": { @@ -5256,8 +5263,8 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true } } @@ -5267,8 +5274,8 @@ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.4.5.tgz", "dependencies": { "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz" + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz" } } }, @@ -5324,8 +5331,8 @@ "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", "dependencies": { "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz" + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz" } } }, @@ -5790,6 +5797,11 @@ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", "dev": true }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "dev": true + }, "resolve": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", @@ -5875,6 +5887,11 @@ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", "dev": true }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "dev": true + }, "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", @@ -5908,8 +5925,8 @@ "dev": true }, "postcss-value-parser": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz" + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz" }, "prebuild-install": { "version": "4.0.0", @@ -5948,8 +5965,8 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz" }, "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", "dev": true }, "progress-bar-formatter": { @@ -6753,12 +6770,12 @@ "resolved": "https://registry.npmjs.org/resin-device-status/-/resin-device-status-1.1.1.tgz" }, "resin-semver": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/resin-semver/-/resin-semver-1.3.0.tgz", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resin-semver/-/resin-semver-1.4.0.tgz", "dependencies": { "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz" + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz" } } }, @@ -7092,8 +7109,8 @@ "dev": true }, "showdown": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/showdown/-/showdown-1.8.6.tgz", + "version": "1.8.7", + "resolved": "https://registry.npmjs.org/showdown/-/showdown-1.8.7.tgz", "dependencies": { "ansi-regex": { "version": "3.0.0", @@ -7371,8 +7388,8 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz" }, "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", "dependencies": { "assert-plus": { "version": "1.0.0", @@ -7527,14 +7544,9 @@ "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.3.tgz", "dev": true, "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "dev": true - }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "dev": true }, "mime": { @@ -7895,8 +7907,7 @@ }, "tweetnacl": { "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "optional": true + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz" }, "type-check": { "version": "0.3.2", @@ -8233,8 +8244,8 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "dev": true }, "touch": { @@ -8356,16 +8367,9 @@ "dev": true }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "dev": true, - "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "dev": true - } - } + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "dev": true }, "har-schema": { "version": "2.0.0", @@ -8636,8 +8640,8 @@ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz" }, "widest-line": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.0.tgz", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", "dev": true, "dependencies": { "ansi-regex": { diff --git a/scripts/build/architecture-convert.sh b/scripts/build/architecture-convert.sh deleted file mode 100755 index e0e7ba16..00000000 --- a/scripts/build/architecture-convert.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -r " - echo " -t " - exit 1 -} - -ARGV_ARCHITECTURE="" -ARGV_TYPE="" - -while getopts ":r:t:" option; do - case $option in - r) ARGV_ARCHITECTURE=$OPTARG ;; - t) ARGV_TYPE=$OPTARG ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_ARCHITECTURE" ] || [ -z "$ARGV_TYPE" ]; then - usage -fi - -RESULT="" - -if [ "$ARGV_TYPE" == "node" ]; then - if [ "$ARGV_ARCHITECTURE" == "x86" ]; then - RESULT=ia32 - elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then - RESULT=x64 - elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then - RESULT=arm - elif [ "$ARGV_ARCHITECTURE" == "aarch64" ]; then - RESULT=arm64 - fi -elif [ "$ARGV_TYPE" == "electron-builder" ]; then - if [ "$ARGV_ARCHITECTURE" == "x86" ]; then - RESULT=ia32 - elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then - RESULT=x64 - elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then - RESULT=armv7l - elif [ "$ARGV_ARCHITECTURE" == "aarch64" ]; then - RESULT=arm64 - fi -elif [ "$ARGV_TYPE" == "debian" ]; then - if [ "$ARGV_ARCHITECTURE" == "x86" ]; then - RESULT=i386 - elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then - RESULT=amd64 - elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then - RESULT=armhf - elif [ "$ARGV_ARCHITECTURE" == "aarch64" ]; then - RESULT=arm64 - fi -elif [ "$ARGV_TYPE" == "redhat" ]; then - if [ "$ARGV_ARCHITECTURE" == "x86" ]; then - RESULT=i686 - elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then - RESULT='x86_64' - elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then - RESULT=armhfp - elif [ "$ARGV_ARCHITECTURE" == "aarch64" ]; then - RESULT=aarch64 - fi -elif [ "$ARGV_TYPE" == "appimage" ]; then - if [ "$ARGV_ARCHITECTURE" == "x86" ]; then - RESULT=i386 - elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then - RESULT='x86_64' - elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then - RESULT=armhf - elif [ "$ARGV_ARCHITECTURE" == "aarch64" ]; then - RESULT=arm64 - fi -elif [ "$ARGV_TYPE" == "docker" ]; then - if [ "$ARGV_ARCHITECTURE" == "x64" ]; then - RESULT=x86_64 - elif [ "$ARGV_ARCHITECTURE" == "x86" ]; then - RESULT=i686 - elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then - RESULT=armv7hf - elif [ "$ARGV_ARCHITECTURE" == "aarch64" ]; then - RESULT=arm64v8 - fi -else - echo "Unsupported architecture type: $ARGV_TYPE" 1>&2 - exit 1 -fi - -if [ -z "$RESULT" ]; then - echo "Unsupported architecture: $ARGV_ARCHITECTURE" 1>&2 - exit 1 -fi - -echo "$RESULT" diff --git a/scripts/build/check-dependency.sh b/scripts/build/check-dependency.sh deleted file mode 100755 index 5b57e2ec..00000000 --- a/scripts/build/check-dependency.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -if [ "$#" -lt 1 ]; then - echo "Usage: $0 " - exit 1 -fi - -RESULT="" -DEPENDENCIES="" - -for dependency in "$@"; do - DEPENDENCIES="$DEPENDENCIES $(echo $dependency | cut -d ' ' -f 1)" - if command -v $dependency 2>/dev/null 1>&2; then - RESULT=$dependency - break - fi -done - -if [ -z "$RESULT" ]; then - if [ "$#" -eq 1 ]; then - echo "Dependency missing:$DEPENDENCIES" 1>&2 - else - echo "No dependency found from:$DEPENDENCIES" 1>&2 - fi - exit 1 -fi - -# Only print back if more than one command was passed -# otherwise if the script passes, its clear that the -# single command checked is the one that exists. -if [ "$#" -ne 1 ]; then - echo $RESULT -fi diff --git a/scripts/build/dependencies-npm-extract-addons.sh b/scripts/build/dependencies-npm-extract-addons.sh deleted file mode 100755 index 2c88f505..00000000 --- a/scripts/build/dependencies-npm-extract-addons.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -./scripts/build/check-dependency.sh rsync - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -d " - echo " -o " - exit 1 -} - -ARGV_NODE_MODULES="" -ARGV_OUTPUT_DIRECTORY="" - -while getopts ":d:o:" option; do - case $option in - d) ARGV_NODE_MODULES=$OPTARG ;; - o) ARGV_OUTPUT_DIRECTORY=$OPTARG ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_NODE_MODULES" ] || [ -z "$ARGV_OUTPUT_DIRECTORY" ]; then - usage -fi - -rsync \ - --archive \ - --prune-empty-dirs \ - --progress \ - --include='*.node' \ - --include='*.dll' \ - --include='*/' \ - --exclude='*' \ - "$ARGV_NODE_MODULES" "$ARGV_OUTPUT_DIRECTORY" - -# rsync creates a `node_modules` directory -# inside the output directory -mv "$ARGV_OUTPUT_DIRECTORY"/node_modules/* "$ARGV_OUTPUT_DIRECTORY" -rmdir "$ARGV_OUTPUT_DIRECTORY/node_modules" diff --git a/scripts/build/dependencies-npm.sh b/scripts/build/dependencies-npm.sh deleted file mode 100755 index 9d55caa4..00000000 --- a/scripts/build/dependencies-npm.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -./scripts/build/check-dependency.sh npm -./scripts/build/check-dependency.sh python - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -r " - echo " -v " - echo " -t " - echo " -s " - echo " -x " - echo " -p production install" - exit 1 -} - -ARGV_ARCHITECTURE="" -ARGV_TARGET_VERSION="" -ARGV_TARGET_PLATFORM="" -ARGV_TARGET_OPERATING_SYSTEM="" -ARGV_PREFIX="" -ARGV_PRODUCTION=false - -while getopts ":r:v:t:s:x:p" option; do - case $option in - r) ARGV_ARCHITECTURE=$OPTARG ;; - v) ARGV_TARGET_VERSION=$OPTARG ;; - t) ARGV_TARGET_PLATFORM=$OPTARG ;; - s) ARGV_TARGET_OPERATING_SYSTEM=$OPTARG ;; - x) ARGV_PREFIX=$OPTARG ;; - p) ARGV_PRODUCTION=true ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_ARCHITECTURE" ] \ - || [ -z "$ARGV_TARGET_VERSION" ] \ - || [ -z "$ARGV_TARGET_PLATFORM" ] \ - || [ -z "$ARGV_TARGET_OPERATING_SYSTEM" ] -then - usage -fi - -if [ "$ARGV_TARGET_OPERATING_SYSTEM" == "win32" ]; then - export GYP_MSVS_VERSION=2015 -fi - -if [ "$ARGV_TARGET_PLATFORM" == "electron" ]; then - - # Ensure native addons are compiled with the correct headers - # See https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md - export npm_config_disturl=https://atom.io/download/electron - export npm_config_runtime=electron - -fi - -export npm_config_target=$ARGV_TARGET_VERSION -export npm_config_build_from_source=true - -ELECTRON_ARCHITECTURE=$(./scripts/build/architecture-convert.sh -r "$ARGV_ARCHITECTURE" -t node) -export npm_config_arch=$ELECTRON_ARCHITECTURE - -INSTALL_OPTS="--fetch-retries 10 --fetch-retry-maxtimeout 180000" - -if [ "$ARGV_PRODUCTION" == "true" ]; then - INSTALL_OPTS="$INSTALL_OPTS --production" -fi - -function run_install() { - - # Since we use an `npm-shrinkwrap.json` file, if you pull changes - # that update a dependency and try to `npm install` directly, npm - # will complain that your `node_modules` tree is not equal to what - # is defined by the `npm-shrinkwrap.json` file, and will thus - # refuse to do anything but install from scratch. - npm prune - - # When changing between target architectures, rebuild all dependencies, - # since compiled add-ons will not work otherwise. - npm rebuild --silent > /dev/null - - npm install --silent $INSTALL_OPTS > /dev/null - - if [ "$ARGV_PRODUCTION" == "true" ]; then - - # Turns out that if `npm-shrinkwrap.json` contains development - # dependencies then `npm install --production` will also install - # those, despite knowing, based on `package.json`, that they are - # really development dependencies. As a workaround, we manually - # delete the development dependencies using `npm prune`. - npm prune --production - - fi -} - -if [ -n "$ARGV_PREFIX" ]; then - cp "$PWD/package.json" "$ARGV_PREFIX/package.json" - - if [ -f "$PWD/npm-shrinkwrap.json" ]; then - cp "$PWD/npm-shrinkwrap.json" "$ARGV_PREFIX/npm-shrinkwrap.json" - fi - - if [ -f "$PWD/binding.gyp" ]; then - cp "$PWD/binding.gyp" "$ARGV_PREFIX/binding.gyp" - fi - - # Handle native code, if any - if [ -d "$PWD/src" ]; then - cp -RLf "$PWD/src" "$ARGV_PREFIX/src" - fi - - pushd "$ARGV_PREFIX" - run_install - popd - - rm -f "$ARGV_PREFIX/package.json" - rm -f "$ARGV_PREFIX/npm-shrinkwrap.json" - rm -f "$ARGV_PREFIX/binding.gyp" - rm -rf "$ARGV_PREFIX/src" -else - run_install -fi diff --git a/scripts/build/docker/Dockerfile-armv7hf b/scripts/build/docker/Dockerfile-armv7hf deleted file mode 100644 index be6e0138..00000000 --- a/scripts/build/docker/Dockerfile-armv7hf +++ /dev/null @@ -1,61 +0,0 @@ -FROM resin/armv7hf-debian:jessie - -# Setup APT sources - - - -RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list - - -# Install dependencies -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - curl \ - fuse \ - git \ - graphicsmagick \ - icnsutils \ - jq \ - libasound2 \ - libgconf-2-4 \ - libgtk2.0-0 \ - libudev-dev \ - libusb-1.0-0-dev \ - libnss3 \ - libx11-xcb1 \ - libxss1 \ - libxtst6 \ - libyaml-dev \ - python \ - python-pip \ - python-dev \ - python-software-properties \ - unzip \ - xorriso \ - xvfb \ - xz-utils \ - zip \ - rpm - -# NodeJS -RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ - && apt-get install -y nodejs - - - -# See https://github.com/mapbox/node-pre-gyp/issues/165 -RUN npm config set unsafe-perm=true - -RUN npm config set spin=false - -# Python -COPY requirements.txt requirements.txt - -# FIXME: Work around "Cannot fetch index base URL http://pypi.python.org/simple/" error -RUN curl -vvv -L "https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz" > pip-9.0.1.tar.gz \ - && tar xvfz pip-9.0.1.tar.gz \ - && cd pip-9.0.1 \ - && python setup.py install - -RUN pip --version && pip install --quiet -r requirements.txt diff --git a/scripts/build/docker/Dockerfile-i686 b/scripts/build/docker/Dockerfile-i686 deleted file mode 100644 index aec875e4..00000000 --- a/scripts/build/docker/Dockerfile-i686 +++ /dev/null @@ -1,75 +0,0 @@ -FROM erwinchang/ubuntu-12.04-32bit-build - -# Setup APT sources - -RUN sed s,ubuntu\.stu\.edu\.tw,archive.ubuntu.com, /etc/apt/sources.list > /tmp/sources.list \ - && mv /tmp/sources.list /etc/apt/sources.list - - - - -# Install dependencies -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - curl \ - fuse \ - git \ - graphicsmagick \ - icnsutils \ - jq \ - libasound2 \ - libgconf-2-4 \ - libgtk2.0-0 \ - libudev-dev \ - libusb-1.0-0-dev \ - libnss3 \ - libx11-xcb1 \ - libxss1 \ - libxtst6 \ - libyaml-dev \ - python \ - python-pip \ - python-dev \ - python-software-properties \ - unzip \ - xorriso \ - xvfb \ - xz-utils \ - zip \ - rpm - -# NodeJS -RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ - && apt-get install -y nodejs - - - -# Install a C++11 compiler -RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ - && apt-get update && apt-get install -y gcc-4.8 g++-4.8 \ - && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50 - -# Workaround: Install a newer version of `tar` to make fpm in electron-builder work again -RUN echo "deb http://ftp.debian.org/debian wheezy main" >> /etc/apt/sources.list -RUN echo "deb http://ftp.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list -RUN apt-get update && apt-get install --force-yes -y -t wheezy libacl1 && \ - apt-get install --force-yes -y -t wheezy-backports tar - - - -# See https://github.com/mapbox/node-pre-gyp/issues/165 -RUN npm config set unsafe-perm=true - -RUN npm config set spin=false - -# Python -COPY requirements.txt requirements.txt - -# FIXME: Work around "Cannot fetch index base URL http://pypi.python.org/simple/" error -RUN curl -vvv -L "https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz" > pip-9.0.1.tar.gz \ - && tar xvfz pip-9.0.1.tar.gz \ - && cd pip-9.0.1 \ - && python setup.py install - -RUN pip --version && pip install --quiet -r requirements.txt diff --git a/scripts/build/docker/Dockerfile-x86_64 b/scripts/build/docker/Dockerfile-x86_64 deleted file mode 100644 index f28f3407..00000000 --- a/scripts/build/docker/Dockerfile-x86_64 +++ /dev/null @@ -1,74 +0,0 @@ -FROM ubuntu:12.04 - -# Setup APT sources - - -RUN echo "deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse" >> /etc/apt/sources.list - - - -# Install dependencies -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - curl \ - fuse \ - git \ - graphicsmagick \ - icnsutils \ - jq \ - libasound2 \ - libgconf-2-4 \ - libgtk2.0-0 \ - libudev-dev \ - libusb-1.0-0-dev \ - libnss3 \ - libx11-xcb1 \ - libxss1 \ - libxtst6 \ - libyaml-dev \ - python \ - python-pip \ - python-dev \ - python-software-properties \ - unzip \ - xorriso \ - xvfb \ - xz-utils \ - zip \ - rpm - -# NodeJS -RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ - && apt-get install -y nodejs - - - -# Install a C++11 compiler -RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ - && apt-get update && apt-get install -y gcc-4.8 g++-4.8 \ - && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50 - -# Workaround: Install a newer version of `tar` to make fpm in electron-builder work again -RUN echo "deb http://ftp.debian.org/debian wheezy main" >> /etc/apt/sources.list -RUN echo "deb http://ftp.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list -RUN apt-get update && apt-get install --force-yes -y -t wheezy libacl1 && \ - apt-get install --force-yes -y -t wheezy-backports tar - - - -# See https://github.com/mapbox/node-pre-gyp/issues/165 -RUN npm config set unsafe-perm=true - -RUN npm config set spin=false - -# Python -COPY requirements.txt requirements.txt - -# FIXME: Work around "Cannot fetch index base URL http://pypi.python.org/simple/" error -RUN curl -vvv -L "https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz" > pip-9.0.1.tar.gz \ - && tar xvfz pip-9.0.1.tar.gz \ - && cd pip-9.0.1 \ - && python setup.py install - -RUN pip --version && pip install --quiet -r requirements.txt diff --git a/scripts/build/docker/Dockerfile.template b/scripts/build/docker/Dockerfile.template deleted file mode 100644 index db222df3..00000000 --- a/scripts/build/docker/Dockerfile.template +++ /dev/null @@ -1,79 +0,0 @@ -FROM <%= image %> - -# Setup APT sources -<% if (architecture == 'i686') { %> -RUN sed s,ubuntu\.stu\.edu\.tw,archive.ubuntu.com, /etc/apt/sources.list > /tmp/sources.list \ - && mv /tmp/sources.list /etc/apt/sources.list -<% } %> -<% if (architecture == 'x86_64') { %> -RUN echo "deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse" >> /etc/apt/sources.list -<% } %> -<% if (architecture == 'armv7hf') { %> -RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list -<% } %> - -# Install dependencies -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - curl \ - fuse \ - git \ - graphicsmagick \ - icnsutils \ - jq \ - libasound2 \ - libgconf-2-4 \ - libgtk2.0-0 \ - libudev-dev \ - libusb-1.0-0-dev \ - libnss3 \ - libx11-xcb1 \ - libxss1 \ - libxtst6 \ - libyaml-dev \ - python \ - python-pip \ - python-dev \ - python-software-properties \ - unzip \ - xorriso \ - xvfb \ - xz-utils \ - zip \ - rpm - -# NodeJS -RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ - && apt-get install -y nodejs - -<% if (architecture != 'armv7hf') { %> - -# Install a C++11 compiler -RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ - && apt-get update && apt-get install -y gcc-4.8 g++-4.8 \ - && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50 - -# Workaround: Install a newer version of `tar` to make fpm in electron-builder work again -RUN echo "deb http://ftp.debian.org/debian wheezy main" >> /etc/apt/sources.list -RUN echo "deb http://ftp.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list -RUN apt-get update && apt-get install --force-yes -y -t wheezy libacl1 && \ - apt-get install --force-yes -y -t wheezy-backports tar - -<% } %> - -# See https://github.com/mapbox/node-pre-gyp/issues/165 -RUN npm config set unsafe-perm=true - -RUN npm config set spin=false - -# Python -COPY requirements.txt requirements.txt - -# FIXME: Work around "Cannot fetch index base URL http://pypi.python.org/simple/" error -RUN curl -vvv -L "https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz" > pip-9.0.1.tar.gz \ - && tar xvfz pip-9.0.1.tar.gz \ - && cd pip-9.0.1 \ - && python setup.py install - -RUN pip --version && pip install --quiet -r requirements.txt diff --git a/scripts/build/docker/README.md b/scripts/build/docker/README.md deleted file mode 100644 index c7dada70..00000000 --- a/scripts/build/docker/README.md +++ /dev/null @@ -1,57 +0,0 @@ -Compile Etcher in Docker -======================== - -This is directory provides the utilities necessary to be able to run GNU/Linux -Etcher (headlessly), compile it, and package it, inside Docker containers. - -This directory provides a set of Dockerfiles for each supported architecture -that are compiled from a base Dockerfile template. The Dockerfiles install -every needed dependency to be able to build and package Etcher for GNU/Linux -targets. - -Running a command inside the Docker images ------------------------------------------- - -We provide a utility script called `run-command.sh` which allows you to run a -command in an environment where you have all the dependencies needed to build -and package Etcher, and in where the Etcher source code is available in the -current working directory. - -For example: - -``` -./run-command.sh \ - -r x64 \ - -s path/to/etcher/repository \ - -c "make info" \ - -b "a/temporary/directory/for/docker/build" -``` - -The above command will build the corresponding Docker file (if needed), and -will run the command on it. - -Architecture dependent Dockerfile steps ---------------------------------------- - -You can declare certain steps to be run for certain architectures by using the -following logic: - -``` -<% if (architecture == 'i686') { %> - ... -<% } %> - -<% if (architecture == 'x86_64') { %> - ... -<% } %> -``` - -Compiling the Dockerfile.template ---------------------------------- - -If you modify the `Dockerfile.template` file, you will need to regenerate the -compiled Dockerfiles by running the `compile-template.js` utility script: - -```sh -node compile-template.js -``` diff --git a/scripts/build/docker/compile-template.js b/scripts/build/docker/compile-template.js deleted file mode 100644 index 0c72735b..00000000 --- a/scripts/build/docker/compile-template.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2016 resin.io - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict' - -// This script generates Dockerfiles based on a template containing all -// the necessary dependencies/ to run and build Etcher in multiple platforms. - -const _ = require('lodash') -const fs = require('fs') -const path = require('path') -const currentDirectory = __dirname - -const template = fs.readFileSync(path.join(currentDirectory, 'Dockerfile.template'), { - encoding: 'utf8' -}) - -_.each([ - { - architecture: 'i686', - image: 'erwinchang/ubuntu-12.04-32bit-build' - }, - { - architecture: 'x86_64', - image: 'ubuntu:12.04' - }, - { - architecture: 'armv7hf', - image: 'resin/armv7hf-debian:jessie' - } -], (options) => { - const result = _.template(template)(options) - const filename = path.join(currentDirectory, `Dockerfile-${options.architecture}`) - fs.writeFileSync(filename, result) -}) diff --git a/scripts/build/download-tool.sh b/scripts/build/download-tool.sh deleted file mode 100755 index a021b03a..00000000 --- a/scripts/build/download-tool.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -./scripts/build/check-dependency.sh curl - -SHA256SUM=$(./scripts/build/check-dependency.sh sha256sum "shasum -a 256") - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -u " - echo " -c " - echo " -x set execute permissions" - echo " -o " - exit 1 -} - -ARGV_URL="" -ARGV_CHECKSUM="" -ARGV_EXECUTE_PERMISSIONS=false -ARGV_OUTPUT="" - -while getopts ":u:c:o:x" option; do - case $option in - u) ARGV_URL="$OPTARG" ;; - c) ARGV_CHECKSUM="$OPTARG" ;; - x) ARGV_EXECUTE_PERMISSIONS=true ;; - o) ARGV_OUTPUT="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_URL" ] || \ - [ -z "$ARGV_CHECKSUM" ] || \ - [ -z "$ARGV_OUTPUT" ] -then - usage -fi - -function checksum_matches() { - local file=$1 - local hash=$2 - test "$($SHA256SUM $file | cut -d ' ' -f1)" = "$hash" -} - -TEMP_OUTPUT="$ARGV_OUTPUT.TMP" - -if [ -f "$TEMP_OUTPUT" ]; then - rm "$TEMP_OUTPUT" -fi - -if [ -f "$ARGV_OUTPUT" ]; then - if checksum_matches "$ARGV_OUTPUT" "$ARGV_CHECKSUM"; then - echo "Re-using from cache" - exit 0 - else - rm "$ARGV_OUTPUT" - fi -fi - -echo "Downloading $ARGV_URL" -curl --continue-at - --retry 100 --location --output "$TEMP_OUTPUT" "$ARGV_URL" - -if ! checksum_matches "$TEMP_OUTPUT" "$ARGV_CHECKSUM"; then - echo "Checksum mismatch" 1>&2 - rm "$TEMP_OUTPUT" - exit 1 -else - mv "$TEMP_OUTPUT" "$ARGV_OUTPUT" -fi - -if [ "$ARGV_EXECUTE_PERMISSIONS" == "true" ]; then - chmod +x "$ARGV_OUTPUT" -fi diff --git a/scripts/build/electron-brand-exe-win32.sh b/scripts/build/electron-brand-exe-win32.sh deleted file mode 100644 index dcccad73..00000000 --- a/scripts/build/electron-brand-exe-win32.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -n " - echo " -d " - echo " -v " - echo " -c " - echo " -m " - echo " -i " - echo " -w " - exit 1 -} - -ARGV_FILE="" -ARGV_APPLICATION_NAME="" -ARGV_APPLICATION_DESCRIPTION="" -ARGV_VERSION="" -ARGV_COPYRIGHT="" -ARGV_COMPANY_NAME="" -ARGV_ICON="" -ARGV_DOWNLOAD_DIRECTORY="" - -while getopts ":f:n:d:v:c:m:i:w:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - n) ARGV_APPLICATION_NAME="$OPTARG" ;; - d) ARGV_APPLICATION_DESCRIPTION="$OPTARG" ;; - v) ARGV_VERSION="$OPTARG" ;; - c) ARGV_COPYRIGHT="$OPTARG" ;; - m) ARGV_COMPANY_NAME="$OPTARG" ;; - i) ARGV_ICON="$OPTARG" ;; - w) ARGV_DOWNLOAD_DIRECTORY="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] \ - || [ -z "$ARGV_APPLICATION_NAME" ] \ - || [ -z "$ARGV_APPLICATION_DESCRIPTION" ] \ - || [ -z "$ARGV_VERSION" ] \ - || [ -z "$ARGV_COPYRIGHT" ] \ - || [ -z "$ARGV_COMPANY_NAME" ] \ - || [ -z "$ARGV_ICON" ] \ - || [ -z "$ARGV_DOWNLOAD_DIRECTORY" ] -then - usage -fi - -RCEDIT_VERSION=v0.7.0 -RCEDIT="$ARGV_DOWNLOAD_DIRECTORY/rcedit.exe" - -./scripts/build/download-tool.sh -x \ - -u "https://github.com/electron/node-rcedit/raw/$RCEDIT_VERSION/bin/rcedit.exe" \ - -c "42649d92e1bbb3af1186fb0ad063df9fcdc18e7b5f2ea82191ecc8fdfaffb0d8" \ - -o "$RCEDIT" - -"$RCEDIT" "$ARGV_FILE" \ - --set-version-string "FileDescription" "$ARGV_APPLICATION_NAME" \ - --set-version-string "InternalName" "$ARGV_APPLICATION_NAME" \ - --set-version-string "OriginalFilename" "$(basename "$ARGV_FILE")" \ - --set-version-string "ProductName" "$ARGV_APPLICATION_NAME - $ARGV_APPLICATION_DESCRIPTION" \ - --set-version-string "CompanyName" "$ARGV_COMPANY_NAME" \ - --set-version-string "LegalCopyright" "$ARGV_COPYRIGHT" \ - --set-file-version "$ARGV_VERSION" \ - --set-product-version "$ARGV_VERSION" \ - --set-icon "$ARGV_ICON" diff --git a/scripts/build/electron-brand-exe.sh b/scripts/build/electron-brand-exe.sh deleted file mode 100755 index dcccad73..00000000 --- a/scripts/build/electron-brand-exe.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -n " - echo " -d " - echo " -v " - echo " -c " - echo " -m " - echo " -i " - echo " -w " - exit 1 -} - -ARGV_FILE="" -ARGV_APPLICATION_NAME="" -ARGV_APPLICATION_DESCRIPTION="" -ARGV_VERSION="" -ARGV_COPYRIGHT="" -ARGV_COMPANY_NAME="" -ARGV_ICON="" -ARGV_DOWNLOAD_DIRECTORY="" - -while getopts ":f:n:d:v:c:m:i:w:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - n) ARGV_APPLICATION_NAME="$OPTARG" ;; - d) ARGV_APPLICATION_DESCRIPTION="$OPTARG" ;; - v) ARGV_VERSION="$OPTARG" ;; - c) ARGV_COPYRIGHT="$OPTARG" ;; - m) ARGV_COMPANY_NAME="$OPTARG" ;; - i) ARGV_ICON="$OPTARG" ;; - w) ARGV_DOWNLOAD_DIRECTORY="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] \ - || [ -z "$ARGV_APPLICATION_NAME" ] \ - || [ -z "$ARGV_APPLICATION_DESCRIPTION" ] \ - || [ -z "$ARGV_VERSION" ] \ - || [ -z "$ARGV_COPYRIGHT" ] \ - || [ -z "$ARGV_COMPANY_NAME" ] \ - || [ -z "$ARGV_ICON" ] \ - || [ -z "$ARGV_DOWNLOAD_DIRECTORY" ] -then - usage -fi - -RCEDIT_VERSION=v0.7.0 -RCEDIT="$ARGV_DOWNLOAD_DIRECTORY/rcedit.exe" - -./scripts/build/download-tool.sh -x \ - -u "https://github.com/electron/node-rcedit/raw/$RCEDIT_VERSION/bin/rcedit.exe" \ - -c "42649d92e1bbb3af1186fb0ad063df9fcdc18e7b5f2ea82191ecc8fdfaffb0d8" \ - -o "$RCEDIT" - -"$RCEDIT" "$ARGV_FILE" \ - --set-version-string "FileDescription" "$ARGV_APPLICATION_NAME" \ - --set-version-string "InternalName" "$ARGV_APPLICATION_NAME" \ - --set-version-string "OriginalFilename" "$(basename "$ARGV_FILE")" \ - --set-version-string "ProductName" "$ARGV_APPLICATION_NAME - $ARGV_APPLICATION_DESCRIPTION" \ - --set-version-string "CompanyName" "$ARGV_COMPANY_NAME" \ - --set-version-string "LegalCopyright" "$ARGV_COPYRIGHT" \ - --set-file-version "$ARGV_VERSION" \ - --set-product-version "$ARGV_VERSION" \ - --set-icon "$ARGV_ICON" diff --git a/scripts/build/electron-create-appdir.sh b/scripts/build/electron-create-appdir.sh deleted file mode 100755 index bb4e210f..00000000 --- a/scripts/build/electron-create-appdir.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -n " - echo " -d " - echo " -p " - echo " -r " - echo " -b " - echo " -i " - echo " -o " - exit 1 -} - -ARGV_APPLICATION_NAME="" -ARGV_DESCRIPTION="" -ARGV_PACKAGE="" -ARGV_ARCHITECTURE="" -ARGV_BINARY="" -ARGV_ICON="" -ARGV_OUTPUT="" - -while getopts ":n:d:p:r:b:i:o:" option; do - case $option in - n) ARGV_APPLICATION_NAME="$OPTARG" ;; - d) ARGV_DESCRIPTION="$OPTARG" ;; - p) ARGV_PACKAGE="$OPTARG" ;; - r) ARGV_ARCHITECTURE="$OPTARG" ;; - b) ARGV_BINARY="$OPTARG" ;; - i) ARGV_ICON="$OPTARG" ;; - o) ARGV_OUTPUT="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_APPLICATION_NAME" ] \ - || [ -z "$ARGV_DESCRIPTION" ] \ - || [ -z "$ARGV_PACKAGE" ] \ - || [ -z "$ARGV_ARCHITECTURE" ] \ - || [ -z "$ARGV_BINARY" ] \ - || [ -z "$ARGV_ICON" ] \ - || [ -z "$ARGV_OUTPUT" ] -then - usage -fi - -# Create AppDir -mkdir -p "$ARGV_OUTPUT" -APPDIR_ICON_FILENAME=icon - -cat >"$ARGV_OUTPUT/$ARGV_APPLICATION_NAME.desktop" <&2 - exit 1 -fi - -./scripts/build/download-tool.sh -x \ - -u "$APPIMAGES_GITHUB_RELEASE_BASE_URL/AppRun_$APPIMAGES_TAG-$APPIMAGES_ARCHITECTURE" \ - -c "$APPRUN_CHECKSUM" \ - -o "$ARGV_OUTPUT/AppRun" diff --git a/scripts/build/electron-create-appimage-linux.sh b/scripts/build/electron-create-appimage-linux.sh deleted file mode 100755 index 01eccd3a..00000000 --- a/scripts/build/electron-create-appimage-linux.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -OS=$(uname) -if [[ "$OS" != "Linux" ]]; then - echo "This script is only meant to be run in GNU/Linux" 1>&2 - exit 1 -fi - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -d " - echo " -r " - echo " -w " - echo " -o " - exit 1 -} - -ARGV_APPDIR="" -ARGV_ARCHITECTURE="" -ARGV_DOWNLOAD_DIRECTORY="" -ARGV_OUTPUT="" - -while getopts ":d:r:w:o:" option; do - case $option in - d) ARGV_APPDIR="$OPTARG" ;; - r) ARGV_ARCHITECTURE="$OPTARG" ;; - w) ARGV_DOWNLOAD_DIRECTORY="$OPTARG" ;; - o) ARGV_OUTPUT="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_APPDIR" ] \ - || [ -z "$ARGV_ARCHITECTURE" ] \ - || [ -z "$ARGV_DOWNLOAD_DIRECTORY" ] \ - || [ -z "$ARGV_OUTPUT" ] -then - usage -fi - -if [ "$ARGV_ARCHITECTURE" == "x64" ]; then - APPIMAGES_ARCHITECTURE="x86_64" - APPIMAGEASSISTANT_CHECKSUM=e792fa6ba1dd81de6438844fde39aa12d6b6d15238154ec46baf01da1c92d59f -elif [ "$ARGV_ARCHITECTURE" == "x86" ]; then - APPIMAGES_ARCHITECTURE="i686" - APPIMAGEASSISTANT_CHECKSUM=0faade0c009e703c221650e414f3b4ea8d03abbd8b9f1f065aef46156ee15dd0 -else - echo "Invalid architecture: $ARGV_ARCHITECTURE" 1>&2 - exit 1 -fi - -APPIMAGES_TAG=6 -APPIMAGES_GITHUB_RELEASE_BASE_URL=https://github.com/probonopd/AppImageKit/releases/download/$APPIMAGES_TAG -APPIMAGEASSISTANT_PATH=$ARGV_DOWNLOAD_DIRECTORY/AppImageAssistant-$ARGV_ARCHITECTURE.AppImage -mkdir -p "$ARGV_DOWNLOAD_DIRECTORY" -./scripts/build/download-tool.sh -x \ - -u "$APPIMAGES_GITHUB_RELEASE_BASE_URL/AppImageAssistant_$APPIMAGES_TAG-$APPIMAGES_ARCHITECTURE.AppImage" \ - -c "$APPIMAGEASSISTANT_CHECKSUM" \ - -o "$APPIMAGEASSISTANT_PATH" - -# Generate AppImage -mkdir -p "$(dirname "$ARGV_OUTPUT")" -$APPIMAGEASSISTANT_PATH "$ARGV_APPDIR" "$ARGV_OUTPUT" diff --git a/scripts/build/electron-sign-exe-win32.sh b/scripts/build/electron-sign-exe-win32.sh deleted file mode 100755 index 447d9072..00000000 --- a/scripts/build/electron-sign-exe-win32.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -OS=$(uname -o 2>/dev/null || true) -if [[ "$OS" != "Msys" ]]; then - echo "This script is only meant to be run in Windows" 1>&2 - exit 1 -fi - -./scripts/build/check-dependency.sh signtool - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -c " - echo " -p " - echo " -d " - exit 1 -} - -ARGV_FILE="" -ARGV_CERTIFICATE_FILE="" -ARGV_CERTIFICATE_PASSWORD="" -ARGV_SIGNATURE_DESCRIPTION="" - -while getopts ":f:c:p:d:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - c) ARGV_CERTIFICATE_FILE="$OPTARG" ;; - p) ARGV_CERTIFICATE_PASSWORD="$OPTARG" ;; - d) ARGV_SIGNATURE_DESCRIPTION="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] || - [ -z "$ARGV_CERTIFICATE_FILE" ] || - [ -z "$ARGV_CERTIFICATE_PASSWORD" ] || - [ -z "$ARGV_SIGNATURE_DESCRIPTION" ] -then - usage -fi - -TIMESTAMP_SERVER=http://timestamp.comodoca.com - -signtool sign \ - -t "$TIMESTAMP_SERVER" \ - -d "$ARGV_SIGNATURE_DESCRIPTION" \ - -f "$ARGV_CERTIFICATE_FILE" \ - -p "$ARGV_CERTIFICATE_PASSWORD" \ - "$ARGV_FILE" - -signtool verify -pa -v "$ARGV_FILE" diff --git a/scripts/build/electron-sign-file-darwin.sh b/scripts/build/electron-sign-file-darwin.sh deleted file mode 100755 index 089f1d7e..00000000 --- a/scripts/build/electron-sign-file-darwin.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -OS=$(uname) -if [[ "$OS" != "Darwin" ]]; then - echo "This script is only meant to be run in OS X" 1>&2 - exit 1 -fi - -./scripts/build/check-dependency.sh codesign - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -i " - exit 1 -} - -ARGV_FILE="" -ARGV_IDENTITY="" - -while getopts ":f:i:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - i) ARGV_IDENTITY="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] || [ -z "$ARGV_IDENTITY" ]; then - usage -fi - -codesign --sign "$ARGV_IDENTITY" -fv "$ARGV_FILE" -codesign --verify --deep --display "$ARGV_FILE" diff --git a/scripts/build/platform-convert.sh b/scripts/build/platform-convert.sh deleted file mode 100755 index 6b46b8bc..00000000 --- a/scripts/build/platform-convert.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -r " - echo " -t " - exit 1 -} - -ARGV_TARGET="" -ARGV_TYPE="" - -while getopts ":r:t:" option; do - case $option in - r) ARGV_TARGET=$OPTARG ;; - t) ARGV_TYPE=$OPTARG ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_TARGET" ] || [ -z "$ARGV_TYPE" ]; then - usage -fi - -RESULT="" - -if [ "$ARGV_TYPE" == "pkg" ]; then - if [ "$ARGV_TARGET" == "linux" ]; then - RESULT=linux - elif [ "$ARGV_TARGET" == "win32" ]; then - RESULT=win - elif [ "$ARGV_TARGET" == "darwin" ]; then - RESULT=macos - fi -else - echo "Unsupported target type: $ARGV_TYPE" 1>&2 - exit 1 -fi - -if [ -z "$RESULT" ]; then - echo "Unsupported target: $ARGV_TARGET" 1>&2 - exit 1 -fi - -echo "$RESULT" diff --git a/scripts/build/tar-gz-file.sh b/scripts/build/tar-gz-file.sh deleted file mode 100755 index 39efee90..00000000 --- a/scripts/build/tar-gz-file.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -./scripts/build/check-dependency.sh tar - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -o " - exit 1 -} - -ARGV_FILE="" -ARGV_OUTPUT="" - -while getopts ":f:o:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - o) ARGV_OUTPUT="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] || [ -z "$ARGV_OUTPUT" ]; then - usage -fi - -CWD=$(pwd) -pushd "$(dirname "$ARGV_FILE")" -tar -czvf "$CWD/$ARGV_OUTPUT" "$(basename "$ARGV_FILE")" -popd diff --git a/scripts/build/zip-file.sh b/scripts/build/zip-file.sh deleted file mode 100755 index e4284a57..00000000 --- a/scripts/build/zip-file.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -./scripts/build/check-dependency.sh zip - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -s " - echo " -o " - exit 1 -} - -ARGV_FILE="" -ARGV_OUTPUT="" - -while getopts ":f:s:o:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - s) ARGV_OPERATING_SYSTEM="$OPTARG" ;; - o) ARGV_OUTPUT="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] || - [ -z "$ARGV_OPERATING_SYSTEM" ] || - [ -z "$ARGV_OUTPUT" ]; then - usage -fi - -CWD=$(pwd) - -# The default unzip tool in Windows already creates a base directory -# whose name equals the zip file name excluding the extension, therefore -# the common practice for zipping directories in this platform is to -# zip their contents instead. -if [ "$ARGV_OPERATING_SYSTEM" == "win32" ] && [ -d "$ARGV_FILE" ]; then - pushd "$ARGV_FILE" - zip -r -9 "$CWD/$ARGV_OUTPUT" * - -else - pushd "$(dirname "$ARGV_FILE")" - zip -r -9 "$CWD/$ARGV_OUTPUT" "$(basename "$ARGV_FILE")" -fi - -popd - diff --git a/scripts/ci/build-installers.sh b/scripts/ci/build-installers.sh deleted file mode 100755 index 45153629..00000000 --- a/scripts/ci/build-installers.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -o " - echo " -r " - exit 1 -} - -ARGV_OPERATING_SYSTEM="" -ARGV_ARCHITECTURE="" - -while getopts ":o:r:" option; do - case $option in - o) ARGV_OPERATING_SYSTEM=$OPTARG ;; - r) ARGV_ARCHITECTURE=$OPTARG ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_OPERATING_SYSTEM" ] || [ -z "$ARGV_ARCHITECTURE" ]; then - usage -fi - -if [ "$ARGV_OPERATING_SYSTEM" == "linux" ]; then - ./scripts/build/docker/run-command.sh \ - -r "$ARGV_ARCHITECTURE" \ - -s "$(pwd)" \ - -c 'make installers-all' -else - ./scripts/build/check-dependency.sh make - export TARGET_ARCH="$ARGV_ARCHITECTURE" - make installers-all -fi diff --git a/scripts/ci/deploy.sh b/scripts/ci/deploy.sh deleted file mode 100755 index 7c5ebf63..00000000 --- a/scripts/ci/deploy.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -o " - echo " -r " - exit 1 -} - -ARGV_OPERATING_SYSTEM="" -ARGV_ARCHITECTURE="" - -while getopts ":o:r:" option; do - case $option in - o) ARGV_OPERATING_SYSTEM=$OPTARG ;; - r) ARGV_ARCHITECTURE=$OPTARG ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_OPERATING_SYSTEM" ] || [ -z "$ARGV_ARCHITECTURE" ]; then - usage -fi - -if [ "$ARGV_OPERATING_SYSTEM" == "linux" ]; then - ./scripts/build/docker/run-command.sh \ - -r "$ARGV_ARCHITECTURE" \ - -s "$(pwd)" \ - -c "make publish-all" -else - ./scripts/build/check-dependency.sh make - export TARGET_ARCH="$ARGV_ARCHITECTURE" - make publish-all -fi diff --git a/scripts/ci/ensure-all-file-extensions-in-gitattributes.sh b/scripts/ci/ensure-all-file-extensions-in-gitattributes.sh index 3be3036d..7f53b1b4 100755 --- a/scripts/ci/ensure-all-file-extensions-in-gitattributes.sh +++ b/scripts/ci/ensure-all-file-extensions-in-gitattributes.sh @@ -19,10 +19,6 @@ set -u set -e -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -"$HERE/../build/check-dependency.sh" git - # Read list of wildcards from .gitattributes wildcards=() while IFS='' read -r line || [[ -n "$line" ]]; do diff --git a/scripts/ci/ensure-npm-dependencies-compatibility.sh b/scripts/ci/ensure-npm-dependencies-compatibility.sh index 34854c35..93030212 100755 --- a/scripts/ci/ensure-npm-dependencies-compatibility.sh +++ b/scripts/ci/ensure-npm-dependencies-compatibility.sh @@ -19,10 +19,6 @@ set -u set -e -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -"$HERE/../build/check-dependency.sh" jq - PACKAGE_JSON=package.json # Two pair-wise arrays, because associative arrays only work in Bash 4 diff --git a/scripts/ci/ensure-npm-shrinkwrap-versions.sh b/scripts/ci/ensure-npm-shrinkwrap-versions.sh deleted file mode 100755 index 86a2a902..00000000 --- a/scripts/ci/ensure-npm-shrinkwrap-versions.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -"$HERE/../build/check-dependency.sh" jq - -SHRINKWRAP_JSON=npm-shrinkwrap.json - -# Two pair-wise arrays, because associative arrays only work in Bash 4 -MODULE_NAMES=("dependencies[\"node-gyp\"]") -MODULE_VERSIONS=("3.5.0") - -if [[ ${#MODULE_NAMES[@]} -ne ${#MODULE_VERSIONS[@]} ]]; then - echo "Lengths of MODULE_NAMES and MODULE_VERSIONS arrays must match" - exit 1 -fi - -for i in ${!MODULE_NAMES[@]}; do - name=${MODULE_NAMES[$i]} - version=${MODULE_VERSIONS[$i]} - shrinkwrap_version=$(jq -r ".$name.version" "$SHRINKWRAP_JSON") - if [[ "$version" != "$shrinkwrap_version" ]]; then - echo "The following dependency must have the exact version in $SHRINKWRAP_JSON:" - echo " $name $version" - exit 1 - fi -done diff --git a/scripts/ci/ensure-npm-valid-dependencies.sh b/scripts/ci/ensure-npm-valid-dependencies.sh deleted file mode 100755 index c8c9c423..00000000 --- a/scripts/ci/ensure-npm-valid-dependencies.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -# This command will exit with an error code if there -# are invalid or extraneous dependencies, printing the -# problematic ones if so. -npm ls >/dev/null diff --git a/scripts/ci/ensure-staged-shrinkwrap.sh b/scripts/ci/ensure-staged-shrinkwrap.sh deleted file mode 100755 index 544bcf29..00000000 --- a/scripts/ci/ensure-staged-shrinkwrap.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -echo "node version: $(node --version)" -echo "npm version: $(npm --version)" - -SHRINKWRAP_FILE=npm-shrinkwrap.json - -npm shrinkwrap --dev - -if [[ -n $(git status -s "$SHRINKWRAP_FILE") ]]; then - echo "There are unstaged $SHRINKWRAP_FILE changes. Please commit the result of:" 1>&2 - echo "" - echo " npm shrinkwrap --dev" 1>&2 - echo "" - git --no-pager diff "$SHRINKWRAP_FILE" - exit 1 -fi diff --git a/scripts/ci/install.sh b/scripts/ci/install.sh deleted file mode 100755 index 8c2b3133..00000000 --- a/scripts/ci/install.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -o " - echo " -r " - exit 1 -} - -ARGV_OPERATING_SYSTEM="" -ARGV_ARCHITECTURE="" - -while getopts ":o:r:" option; do - case $option in - o) ARGV_OPERATING_SYSTEM=$OPTARG ;; - r) ARGV_ARCHITECTURE=$OPTARG ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_OPERATING_SYSTEM" ] || [ -z "$ARGV_ARCHITECTURE" ]; then - usage -fi - -if [ "$ARGV_OPERATING_SYSTEM" == "linux" ]; then - ./scripts/build/docker/run-command.sh \ - -r "$ARGV_ARCHITECTURE" \ - -s "$(pwd)" \ - -c "make info && make electron-develop" -else - PIP_COMMAND=pip - if [ "$ARGV_OPERATING_SYSTEM" == "darwin" ]; then - ./scripts/build/check-dependency.sh brew - brew install ccache jq --force-bottle - PIP_COMMAND=pip2 - elif [ "$ARGV_OPERATING_SYSTEM" == "win32" ]; then - ./scripts/build/check-dependency.sh choco - choco install jq - choco install curl - else - echo "Unsupported operating system: $ARGV_OPERATING_SYSTEM" 1>&2 - exit 1 - fi - - ./scripts/build/check-dependency.sh npm - ./scripts/build/check-dependency.sh "$PIP_COMMAND" - ./scripts/build/check-dependency.sh make - - npm config set spin=false - npm config set progress=false - "$PIP_COMMAND" install --quiet -r requirements.txt - - export TARGET_ARCH="$ARGV_ARCHITECTURE" - make info - make electron-develop - make webpack -fi diff --git a/scripts/ci/test.sh b/scripts/ci/test.sh deleted file mode 100755 index 79fea7f0..00000000 --- a/scripts/ci/test.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -### -# Copyright 2017 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -e -set -u - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -o " - echo " -r " - exit 1 -} - -ARGV_OPERATING_SYSTEM="" -ARGV_ARCHITECTURE="" - -while getopts ":o:r:" option; do - case $option in - o) ARGV_OPERATING_SYSTEM=$OPTARG ;; - r) ARGV_ARCHITECTURE=$OPTARG ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_OPERATING_SYSTEM" ] || [ -z "$ARGV_ARCHITECTURE" ]; then - usage -fi - -if [ "$ARGV_OPERATING_SYSTEM" == "linux" ]; then - ./scripts/build/docker/run-command.sh \ - -r "$ARGV_ARCHITECTURE" \ - -s "$(pwd)" \ - -c 'xvfb-run --server-args=$XVFB_ARGS make webpack lint test sanity-checks' -else - ./scripts/build/check-dependency.sh make - export TARGET_ARCH="$ARGV_ARCHITECTURE" - make webpack lint test sanity-checks -fi diff --git a/scripts/build/docker/run-command.sh b/scripts/docker-run-command.sh similarity index 76% rename from scripts/build/docker/run-command.sh rename to scripts/docker-run-command.sh index 84937c50..68dc15d0 100755 --- a/scripts/build/docker/run-command.sh +++ b/scripts/docker-run-command.sh @@ -19,46 +19,39 @@ set -u set -e -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -"$HERE/../check-dependency.sh" docker - function usage() { echo "Usage: $0" echo "" echo "Options" echo "" - echo " -r " + echo " -d " echo " -s " echo " -c " exit 1 } -ARGV_ARCHITECTURE="" +ARGV_DOCKERFILE="" ARGV_SOURCE_CODE_DIRECTORY="" ARGV_COMMAND="" -while getopts ":r:s:c:" option; do +while getopts ":d:s:c:" option; do case $option in - r) ARGV_ARCHITECTURE=$OPTARG ;; + d) ARGV_DOCKERFILE=$OPTARG ;; s) ARGV_SOURCE_CODE_DIRECTORY=$OPTARG ;; c) ARGV_COMMAND=$OPTARG ;; *) usage ;; esac done -if [ -z "$ARGV_ARCHITECTURE" ] \ +if [ -z "$ARGV_DOCKERFILE" ] \ || [ -z "$ARGV_SOURCE_CODE_DIRECTORY" ] \ || [ -z "$ARGV_COMMAND" ] then usage fi -DOCKER_ARCHITECTURE=$(./scripts/build/architecture-convert.sh -r "$ARGV_ARCHITECTURE" -t docker) -DOCKERFILE="$HERE/Dockerfile-$DOCKER_ARCHITECTURE" -IMAGE_ID="etcher-build-$DOCKER_ARCHITECTURE" - -docker build -f "$DOCKERFILE" -t "$IMAGE_ID" "$ARGV_SOURCE_CODE_DIRECTORY" +IMAGE_ID="etcher-build-$(basename "$ARGV_DOCKERFILE")" +docker build -f "$ARGV_DOCKERFILE" -t "$IMAGE_ID" "$ARGV_SOURCE_CODE_DIRECTORY" # Docker complains with: ". includes invalid characters for a local # volume name, only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed" otherwise @@ -73,7 +66,7 @@ fi # and http://mywiki.wooledge.org/BashFAQ/050 # and http://stackoverflow.com/a/7577209 DOCKER_ENVVARS=() -for COPYVAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY ANALYTICS_SENTRY_TOKEN ANALYTICS_MIXPANEL_TOKEN RELEASE_TYPE BINTRAY_USER BINTRAY_API_KEY CI; do +for COPYVAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY ANALYTICS_SENTRY_TOKEN ANALYTICS_MIXPANEL_TOKEN CI; do eval "if [ ! -z \${$COPYVAR+x} ]; then DOCKER_ENVVARS+=(\"--env\" \"$COPYVAR=\$$COPYVAR\"); fi" done @@ -82,7 +75,6 @@ done # The `-t` and TERM setup is needed to display coloured output. docker run -t \ --env "TERM=xterm-256color" \ - --env "TARGET_ARCH=$ARGV_ARCHITECTURE" \ ${DOCKER_ENVVARS[@]+"${DOCKER_ENVVARS[@]}"} \ --privileged \ --cap-add SYS_ADMIN \ diff --git a/scripts/publish/aws-s3.sh b/scripts/publish/aws-s3.sh deleted file mode 100755 index 055cc87f..00000000 --- a/scripts/publish/aws-s3.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -# See http://www.davidpashley.com/articles/writing-robust-shell-scripts/ -set -u -set -e - -./scripts/build/check-dependency.sh aws - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -b " - echo " -v " - echo " -p " - echo " -k [S3 key prefix]" - exit 1 -} - -ARGV_FILE="" -ARGV_BUCKET="" -ARGV_VERSION="" -ARGV_PRODUCT_NAME="" -ARGV_PREFIX="" - -while getopts ":f:b:v:p:k:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - b) ARGV_BUCKET="$OPTARG" ;; - v) ARGV_VERSION="$OPTARG" ;; - p) ARGV_PRODUCT_NAME="$OPTARG" ;; - k) ARGV_PREFIX="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] || \ - [ -z "$ARGV_BUCKET" ] || \ - [ -z "$ARGV_VERSION" ] || \ - [ -z "$ARGV_PRODUCT_NAME" ] -then - usage -fi - -FILENAME=$(basename "$ARGV_FILE") - -if [ -n "$ARGV_PREFIX" ]; then - S3_KEY="$ARGV_PRODUCT_NAME/$ARGV_PREFIX/$ARGV_VERSION/$FILENAME" -else - S3_KEY="$ARGV_PRODUCT_NAME/$ARGV_VERSION/$FILENAME" -fi - -aws s3api put-object \ - --bucket "$ARGV_BUCKET" \ - --acl public-read \ - --key "$S3_KEY" \ - --body "$ARGV_FILE" - -# Escape plus signs when printing the final URL -URL="$(echo "https://$ARGV_BUCKET.s3.amazonaws.com/$S3_KEY" | sed 's/\+/%2B/g')" - -echo "Uploaded $(basename "$ARGV_FILE") to $URL" diff --git a/scripts/publish/bintray.sh b/scripts/publish/bintray.sh deleted file mode 100755 index 091d41a2..00000000 --- a/scripts/publish/bintray.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash - -### -# Copyright 2016 resin.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -### - -set -u -set -e - -./scripts/build/check-dependency.sh curl - -function usage() { - echo "Usage: $0" - echo "" - echo "Options" - echo "" - echo " -f " - echo " -v " - echo " -r " - echo " -t " - echo " -o " - echo " -p " - echo " -c " - echo " -y " - exit 1 -} - -ARGV_FILE="" -ARGV_VERSION="" -ARGV_ARCHITECTURE="" -ARGV_RELEASE_TYPE="" -ARGV_ORGANIZATION="" -ARGV_REPOSITORY="" -ARGV_COMPONENT="" -ARGV_TYPE="" - -while getopts ":f:v:r:t:o:p:c:y:" option; do - case $option in - f) ARGV_FILE="$OPTARG" ;; - v) ARGV_VERSION="$OPTARG" ;; - r) ARGV_ARCHITECTURE="$OPTARG" ;; - t) ARGV_RELEASE_TYPE="$OPTARG" ;; - o) ARGV_ORGANIZATION="$OPTARG" ;; - p) ARGV_REPOSITORY="$OPTARG" ;; - c) ARGV_COMPONENT="$OPTARG" ;; - y) ARGV_TYPE="$OPTARG" ;; - *) usage ;; - esac -done - -if [ -z "$ARGV_FILE" ] || \ - [ -z "$ARGV_VERSION" ] || \ - [ -z "$ARGV_ARCHITECTURE" ] || \ - [ -z "$ARGV_RELEASE_TYPE" ] || \ - [ -z "$ARGV_ORGANIZATION" ] || \ - [ -z "$ARGV_REPOSITORY" ] || \ - [ -z "$ARGV_COMPONENT" ] || \ - [ -z "$ARGV_TYPE" ] -then - usage -fi - -set +u -if [ -z "$BINTRAY_USER" ] || [ -z "$BINTRAY_API_KEY" ]; then - echo "Please define the following environment variables:" 1>&2 - echo "" 1>&2 - echo " BINTRAY_USER" 1>&2 - echo " BINTRAY_API_KEY" 1>&2 - exit 1 -fi -set -u - -if [ "$ARGV_RELEASE_TYPE" == "production" ]; then - PACKAGE_DISTRIBUTION=stable -elif [ "$ARGV_RELEASE_TYPE" == "snapshot" ]; then - PACKAGE_DISTRIBUTION=devel -else - echo "Invalid release type: $ARGV_RELEASE_TYPE" 1>&2 - exit 1 -fi - -PACKAGE_FILE_NAME=$(basename $ARGV_FILE) -PACKAGE_NAME=${PACKAGE_FILE_NAME%.*} -PACKAGE_ARCHITECTURE=$(./scripts/build/architecture-convert.sh -r "$ARGV_ARCHITECTURE" -t "$ARGV_TYPE") - -curl --upload-file $ARGV_FILE \ - --user $BINTRAY_USER:$BINTRAY_API_KEY \ - --header "X-Bintray-Override: 1" \ - --header "X-Bintray-Publish: 1" \ - --header "X-Bintray-Debian-Distribution: $PACKAGE_DISTRIBUTION" \ - --header "X-Bintray-Debian-Component: $ARGV_COMPONENT" \ - --header "X-Bintray-Debian-Architecture: $PACKAGE_ARCHITECTURE" \ - https://api.bintray.com/content/$ARGV_ORGANIZATION/$ARGV_REPOSITORY/$ARGV_COMPONENT/$ARGV_VERSION/$PACKAGE_FILE_NAME - -echo "$ARGV_FILE has been uploaded successfully" diff --git a/scripts/resin b/scripts/resin new file mode 160000 index 00000000..8baa9e9a --- /dev/null +++ b/scripts/resin @@ -0,0 +1 @@ +Subproject commit 8baa9e9a4063edc0b597baf16e266e28ed460b94