Merge pull request #2488 from resin-io/refactor-build-system

Use Resin CI scripts to build Etcher
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2018-10-23 00:02:35 +02:00 committed by GitHub
commit eeede318fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 157 additions and 2616 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "scripts/resin"]
path = scripts/resin
url = git@github.com:resin-io/scripts.git

473
Makefile
View File

@ -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 $</node_modules \
-o $@/node_modules
# pkg currently has a bug where darwin executables
# can't be code-signed
# See https://github.com/zeit/pkg/issues/128
# ifeq ($(PLATFORM),darwin)
# ifdef CSC_NAME
# ./scripts/build/electron-sign-file-darwin.sh -f $@/$(ETCHER_CLI_BINARY) -i "$(CSC_NAME)"
# endif
# endif
# pkg currently has a bug where Windows executables
# can't be branded
# See https://github.com/zeit/pkg/issues/149
# ifeq ($(PLATFORM),win32)
# ./scripts/build/electron-brand-exe.sh \
# -f $@/$(ETCHER_CLI_BINARY) \
# -n $(APPLICATION_NAME) \
# -d "$(APPLICATION_DESCRIPTION)" \
# -v "$(APPLICATION_VERSION)" \
# -c "$(APPLICATION_COPYRIGHT)" \
# -m "$(COMPANY_NAME)" \
# -i assets/icon.ico \
# -w $(BUILD_TEMPORARY_DIRECTORY)
# endif
ifeq ($(PLATFORM),win32)
ifdef CSC_LINK
ifdef CSC_KEY_PASSWORD
./scripts/build/electron-sign-exe-win32.sh -f $@/$(ETCHER_CLI_BINARY) \
-d "$(APPLICATION_NAME) - $(APPLICATION_VERSION)" \
-c $(CSC_LINK) \
-p $(CSC_KEY_PASSWORD)
endif
endif
endif
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).zip: \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH)
./scripts/build/zip-file.sh -f $< -s $(PLATFORM) -o $@
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).tar.gz: \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH)
./scripts/build/tar-gz-file.sh -f $< -o $@
# ---------------------------------------------------------------------
# GUI
# ---------------------------------------------------------------------
assets/dmg/background.tiff: assets/dmg/background.png assets/dmg/background@2x.png
tiffutil -cathidpicheck $^ -out $@
build/js/gui.js: .FORCE
webpack
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-$(APPLICATION_VERSION).dmg: assets/dmg/background.tiff build/js/gui.js \
| $(BUILD_DIRECTORY)
TARGET_ARCH=$(TARGET_ARCH) build --mac dmg $(ELECTRON_BUILDER_OPTIONS) \
--extraMetadata.version=$(APPLICATION_VERSION) \
--extraMetadata.packageType=dmg
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-$(APPLICATION_VERSION)-mac.zip: assets/dmg/background.tiff build/js/gui.js \
| $(BUILD_DIRECTORY)
TARGET_ARCH=$(TARGET_ARCH) build --mac zip $(ELECTRON_BUILDER_OPTIONS) \
--extraMetadata.version=$(APPLICATION_VERSION) \
--extraMetadata.packageType=zip
APPLICATION_NAME_ELECTRON = $(APPLICATION_NAME_LOWERCASE)-electron
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_ELECTRON)-$(APPLICATION_VERSION_REDHAT).$(TARGET_ARCH_REDHAT).rpm: build/js/gui.js \
| $(BUILD_DIRECTORY)
build --linux rpm $(ELECTRON_BUILDER_OPTIONS) \
--extraMetadata.name=$(APPLICATION_NAME_ELECTRON) \
--extraMetadata.version=$(APPLICATION_VERSION_REDHAT) \
--extraMetadata.packageType=rpm
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_ELECTRON)_$(APPLICATION_VERSION_DEBIAN)_$(TARGET_ARCH_DEBIAN).deb: build/js/gui.js \
| $(BUILD_DIRECTORY)
build --linux deb $(ELECTRON_BUILDER_OPTIONS) \
--extraMetadata.name=$(APPLICATION_NAME_ELECTRON) \
--extraMetadata.version=$(APPLICATION_VERSION_DEBIAN) \
--extraMetadata.packageType=deb
ifeq ($(TARGET_ARCH),x64)
ELECTRON_BUILDER_LINUX_UNPACKED_DIRECTORY = linux-unpacked
else
ELECTRON_BUILDER_LINUX_UNPACKED_DIRECTORY = linux-$(TARGET_ARCH_ELECTRON_BUILDER)-unpacked
endif
$(BUILD_DIRECTORY)/$(ELECTRON_BUILDER_LINUX_UNPACKED_DIRECTORY)/$(APPLICATION_NAME_ELECTRON): build/js/gui.js | $(BUILD_DIRECTORY)
build --dir --linux $(ELECTRON_BUILDER_OPTIONS) \
--extraMetadata.name=$(APPLICATION_NAME_ELECTRON) \
--extraMetadata.version=$(APPLICATION_VERSION) \
--extraMetadata.packageType=AppImage
touch $@
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_LOWERCASE)-$(APPLICATION_VERSION)-$(PLATFORM).AppDir: \
$(BUILD_DIRECTORY)/$(ELECTRON_BUILDER_LINUX_UNPACKED_DIRECTORY)/$(APPLICATION_NAME_ELECTRON) \
| $(BUILD_DIRECTORY)
./scripts/build/electron-create-appdir.sh \
-n $(APPLICATION_NAME) \
-d "$(APPLICATION_DESCRIPTION)" \
-p $(dir $<) \
cli-develop: | $(BUILD_TEMPORARY_DIRECTORY)
$(RESIN_SCRIPTS)/node-cli/install.sh \
-b $(shell pwd) \
-r $(TARGET_ARCH) \
-b $(APPLICATION_NAME_ELECTRON) \
-i assets/icon.png \
-o $@
-s $(PLATFORM) \
-n $(BUILD_TEMPORARY_DIRECTORY)/npm \
-a $(S3_BUCKET)
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_LOWERCASE)-$(APPLICATION_VERSION)-$(TARGET_ARCH_APPIMAGE).AppImage: \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_LOWERCASE)-$(APPLICATION_VERSION)-$(PLATFORM).AppDir \
| $(BUILD_DIRECTORY) $(BUILD_TEMPORARY_DIRECTORY)
./scripts/build/electron-create-appimage-linux.sh \
-d $< \
cli-test:
$(RESIN_SCRIPTS)/node-cli/test.sh \
-b $(shell pwd)
cli-build: | $(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) \
-o $@
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_LOWERCASE)-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH_APPIMAGE).zip: \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_LOWERCASE)-$(APPLICATION_VERSION)-$(TARGET_ARCH_APPIMAGE).AppImage \
| $(BUILD_DIRECTORY)
./scripts/build/zip-file.sh -f $< -s $(PLATFORM) -o $@
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-Portable-$(APPLICATION_VERSION)-$(TARGET_ARCH).exe: build/js/gui.js \
| $(BUILD_DIRECTORY)
TARGET_ARCH=$(TARGET_ARCH) build --win portable $(ELECTRON_BUILDER_OPTIONS) \
--extraMetadata.version=$(APPLICATION_VERSION) \
--extraMetadata.packageType=portable
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-Setup-$(APPLICATION_VERSION)-$(TARGET_ARCH).exe: build/js/gui.js \
| $(BUILD_DIRECTORY)
TARGET_ARCH=$(TARGET_ARCH) build --win nsis $(ELECTRON_BUILDER_OPTIONS) \
--extraMetadata.version=$(APPLICATION_VERSION) \
--extraMetadata.packageType=nsis
-a $(S3_BUCKET)
# ---------------------------------------------------------------------
# Phony targets
@ -394,151 +167,26 @@ TARGETS = \
distclean \
changelog \
webpack \
package-electron \
package-cli \
cli-develop \
installers-all \
publish-all \
electron-develop
cli-test \
cli-build \
electron-develop \
electron-test \
electron-build
changelog:
versionist
webpack: build/js/gui.js
package-electron:
TARGET_ARCH=$(TARGET_ARCH) build --dir $(ELECTRON_BUILDER_OPTIONS)
package-cli: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH)
ifeq ($(PLATFORM),darwin)
electron-installer-app-zip: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-$(APPLICATION_VERSION)-mac.zip
electron-installer-dmg: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-$(APPLICATION_VERSION).dmg
cli-installer-tar-gz: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).tar.gz
TARGETS += \
electron-installer-dmg \
electron-installer-app-zip \
cli-installer-tar-gz
PUBLISH_AWS_S3 += \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-$(APPLICATION_VERSION)-mac.zip \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-$(APPLICATION_VERSION).dmg \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).tar.gz
endif
ifeq ($(PLATFORM),linux)
electron-installer-appimage: $(BUILD_DIRECTORY)/$(APPLICATION_NAME_LOWERCASE)-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH_APPIMAGE).zip
electron-installer-debian: $(BUILD_DIRECTORY)/$(APPLICATION_NAME_ELECTRON)_$(APPLICATION_VERSION_DEBIAN)_$(TARGET_ARCH_DEBIAN).deb
electron-installer-redhat: $(BUILD_DIRECTORY)/$(APPLICATION_NAME_ELECTRON)-$(APPLICATION_VERSION_REDHAT).$(TARGET_ARCH_REDHAT).rpm
cli-installer-tar-gz: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).tar.gz
TARGETS += \
electron-installer-appimage \
electron-installer-debian \
electron-installer-redhat \
cli-installer-tar-gz
PUBLISH_AWS_S3 += \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_LOWERCASE)-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH_APPIMAGE).zip \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).tar.gz
PUBLISH_BINTRAY_DEBIAN += \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_ELECTRON)_$(APPLICATION_VERSION_DEBIAN)_$(TARGET_ARCH_DEBIAN).deb
PUBLISH_BINTRAY_REDHAT += \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME_ELECTRON)-$(APPLICATION_VERSION_REDHAT).$(TARGET_ARCH_REDHAT).rpm
endif
ifeq ($(PLATFORM),win32)
electron-installer-portable: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-Portable-$(APPLICATION_VERSION)-$(TARGET_ARCH).exe
electron-installer-nsis: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-Setup-$(APPLICATION_VERSION)-$(TARGET_ARCH).exe
cli-installer-zip: $(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).zip
TARGETS += \
electron-installer-portable \
electron-installer-nsis \
cli-installer-zip
PUBLISH_AWS_S3 += \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-Portable-$(APPLICATION_VERSION)-$(TARGET_ARCH).exe \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-Setup-$(APPLICATION_VERSION)-$(TARGET_ARCH).exe \
$(BUILD_DIRECTORY)/$(APPLICATION_NAME)-cli-$(APPLICATION_VERSION)-$(PLATFORM)-$(TARGET_ARCH).zip
endif
installers-all: $(PUBLISH_AWS_S3) $(PUBLISH_BINTRAY_DEBIAN) $(PUBLISH_BINTRAY_REDHAT)
ifdef PUBLISH_AWS_S3
publish-aws-s3: $(PUBLISH_AWS_S3)
ifeq ($(RELEASE_TYPE),production)
$(foreach publishable,$^,$(call execute-command,./scripts/publish/aws-s3.sh \
-f $(publishable) \
-b $(S3_BUCKET) \
-v $(APPLICATION_VERSION) \
-p $(APPLICATION_NAME_LOWERCASE)))
endif
ifeq ($(RELEASE_TYPE),snapshot)
$(foreach publishable,$^,$(call execute-command,./scripts/publish/aws-s3.sh \
-f $(publishable) \
-b $(S3_BUCKET) \
-v $(APPLICATION_VERSION) \
-p $(APPLICATION_NAME_LOWERCASE) \
-k $(shell date +"%Y-%m-%d")))
endif
PUBLISHABLES += publish-aws-s3
TARGETS += publish-aws-s3
endif
ifeq ($(RELEASE_TYPE),production)
ifdef PUBLISH_BINTRAY_DEBIAN
publish-bintray-debian: $(PUBLISH_BINTRAY_DEBIAN)
$(foreach publishable,$^,$(call execute-command,./scripts/publish/bintray.sh \
-f $(publishable) \
-v $(APPLICATION_VERSION_DEBIAN) \
-r $(TARGET_ARCH) \
-t $(RELEASE_TYPE) \
-o $(BINTRAY_ORGANIZATION) \
-p $(BINTRAY_REPOSITORY_DEBIAN) \
-c $(BINTRAY_COMPONENT) \
-y debian))
PUBLISHABLES += publish-bintray-debian
TARGETS += publish-bintray-debian
endif
ifdef PUBLISH_BINTRAY_REDHAT
publish-bintray-redhat: $(PUBLISH_BINTRAY_REDHAT)
$(foreach publishable,$^,$(call execute-command,./scripts/publish/bintray.sh \
-f $(publishable) \
-v $(APPLICATION_VERSION_REDHAT) \
-r $(TARGET_ARCH) \
-t $(RELEASE_TYPE) \
-o $(BINTRAY_ORGANIZATION) \
-p $(BINTRAY_REPOSITORY_REDHAT) \
-c $(BINTRAY_COMPONENT) \
-y redhat))
PUBLISHABLES += publish-bintray-redhat
TARGETS += publish-bintray-redhat
endif
endif
publish-all: $(PUBLISHABLES)
webpack:
./node_modules/.bin/webpack
.PHONY: $(TARGETS)
cli-develop:
./scripts/build/dependencies-npm.sh \
-r "$(TARGET_ARCH)" \
-v "$(NODE_VERSION)" \
-t node \
-s "$(PLATFORM)"
electron-develop:
./scripts/build/dependencies-npm.sh \
-r "$(TARGET_ARCH)" \
-v "$(ELECTRON_VERSION)" \
-t electron \
-s "$(PLATFORM)"
sass:
node-sass lib/gui/app/scss/main.scss > 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

166
npm-shrinkwrap.json generated
View File

@ -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": {

View File

@ -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 <architecture>"
echo " -t <type (debian|redhat|node|docker|electron-builder|appimage)>"
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"

View File

@ -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 <dependency...>"
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

View File

@ -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 <node_modules directory>"
echo " -o <output directory>"
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"

View File

@ -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 <architecture>"
echo " -v <target version>"
echo " -t <target platform (node|electron)>"
echo " -s <target operating system>"
echo " -x <install prefix>"
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
```

View File

@ -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)
})

View File

@ -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 <url>"
echo " -c <sha256 checksum>"
echo " -x set execute permissions"
echo " -o <output>"
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

View File

@ -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 <file (.exe)>"
echo " -n <application name>"
echo " -d <application description>"
echo " -v <application version>"
echo " -c <application copyright>"
echo " -m <company name>"
echo " -i <application icon (.ico)>"
echo " -w <download directory>"
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"

View File

@ -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 <file (.exe)>"
echo " -n <application name>"
echo " -d <application description>"
echo " -v <application version>"
echo " -c <application copyright>"
echo " -m <company name>"
echo " -i <application icon (.ico)>"
echo " -w <download directory>"
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"

View File

@ -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 <application name>"
echo " -d <application description>"
echo " -p <application package>"
echo " -r <application architecture>"
echo " -b <application binary name>"
echo " -i <application icon (.png)>"
echo " -o <output>"
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" <<EOF
[Desktop Entry]
Name=$ARGV_APPLICATION_NAME
Exec=$ARGV_BINARY.wrapper
Comment=$ARGV_DESCRIPTION
Icon=$APPDIR_ICON_FILENAME
Type=Application
EOF
cp "$ARGV_ICON" "$ARGV_OUTPUT/$APPDIR_ICON_FILENAME.png"
mkdir -p "$ARGV_OUTPUT/usr/bin"
cp -rf "$ARGV_PACKAGE"/* "$ARGV_OUTPUT/usr/bin"
APPIMAGES_TAG=6
APPIMAGES_GITHUB_RAW_BASE_URL=https://raw.githubusercontent.com/probonopd/AppImageKit/$APPIMAGES_TAG
APPIMAGES_GITHUB_RELEASE_BASE_URL=https://github.com/probonopd/AppImageKit/releases/download/$APPIMAGES_TAG
./scripts/build/download-tool.sh -x \
-u "$APPIMAGES_GITHUB_RAW_BASE_URL/desktopintegration" \
-c "bf321258134fa1290b3b3c005332d2aa04ca241e65c21c16c0ab76e892ef6044" \
-o "$ARGV_OUTPUT/usr/bin/$ARGV_BINARY.wrapper"
if [ "$ARGV_ARCHITECTURE" == "x64" ]; then
APPIMAGES_ARCHITECTURE="x86_64"
APPRUN_CHECKSUM=28b9c59facd7d0211ef5d825cc00873324cc75163902c48e80e34bf314c910c4
elif [ "$ARGV_ARCHITECTURE" == "x86" ]; then
APPIMAGES_ARCHITECTURE="i686"
APPRUN_CHECKSUM=44a56d8a654891030bab57cee4670550ed550f6c63aa7d82377a25828671088b
else
echo "Invalid architecture: $ARGV_ARCHITECTURE" 1>&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"

View File

@ -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 <appdir>"
echo " -r <application architecture>"
echo " -w <download directory>"
echo " -o <output>"
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"

View File

@ -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 <file (.exe)>"
echo " -c <certificate file (.p12)>"
echo " -p <certificate password>"
echo " -d <signature description>"
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"

View File

@ -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 <file>"
echo " -i <identity>"
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"

View File

@ -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 <target>"
echo " -t <type (pkg)>"
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"

View File

@ -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 <file>"
echo " -o <output>"
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

View File

@ -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 <file>"
echo " -s <operating system>"
echo " -o <output>"
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

View File

@ -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 <operating system>"
echo " -r <architecture>"
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

View File

@ -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 <operating system>"
echo " -r <architecture>"
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <operating system>"
echo " -r <architecture>"
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

View File

@ -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 <operating system>"
echo " -r <architecture>"
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

View File

@ -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 <architecture>"
echo " -d <dockerfile>"
echo " -s <source code directory>"
echo " -c <command>"
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 \

View File

@ -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 <file>"
echo " -b <s3 bucket>"
echo " -v <version>"
echo " -p <product name>"
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"

View File

@ -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 <file>"
echo " -v <version>"
echo " -r <architecture>"
echo " -t <release type (production|snapshot)>"
echo " -o <bintray organization>"
echo " -p <bintray repository>"
echo " -c <bintray component>"
echo " -y <project type (debian|redhat)>"
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"

1
scripts/resin Submodule

@ -0,0 +1 @@
Subproject commit 8baa9e9a4063edc0b597baf16e266e28ed460b94