130 Commits

Author SHA1 Message Date
Andrew Scheller
dcbe41bc40
fix(scripts): Add missing types to architecture-convert.sh usage (#2089)
Change-type: patch
2018-02-26 18:37:54 +00:00
Jonas Hermsmeier
6990d7632a
fix(Makefile): Support arm64 / armv8 / aarch64
This adds support for 64bit arm cpu architectures.

Change-Type: patch
Changelog-Entry: Support building Etcher on armv8
2018-02-16 15:29:47 +01:00
Jonas Hermsmeier
abfa44a088 upgrade(package): Bump electron-builder 19.9.1 -> 19.40.0 (#1905)
Change-Type: patch
Connects To: #1914
2017-12-19 13:53:26 -04:00
Jonas Hermsmeier
c0d25786ef
fix(scripts): Fix pip install in docker (#1818)
This works around the "Cannot fetch index base URL http://pypi.python.org/simple/"
error by installing pip==9.0.1 directly from the pypi.python.org/packages/

Change-Type: patch
2017-10-31 14:04:00 +01:00
Juan Cruz Viotti
f6a7b2add6 feat: implement usbboot adapter (#1686)
This commit installs `node-usb` v1.3.0 from GitHub, since that version
was never published to NPM, and is the only one that works with Visual
Studio 2015 (see https://github.com/tessel/node-usb/issues/109).

The usbboot communicates with a Raspberry Pi / Amber through USB and
eventually mounts it as a block device we can write to.

This feature bundles bootcode.bin and start.elf from the original
usbboot implementation.

The flow is the following:

- On each scan, the usbboot scanner will try to get a usbboot compatible
  USB device to the next "phase", until they are all transformed to
  block devices the user can flash to as usual

Change-Type: minor
Changelog-Entry: Integrate Raspberry Pi's usbboot technology.
Fixes: https://github.com/resin-io/etcher/issues/1541
See: https://github.com/raspberrypi/usbboot
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-10-06 14:19:35 +01:00
Juan Cruz Viotti
488f281ec7 chore: build armhf on GNU/Linux (#1482)
This commit makes use of the `resin/armv7hf-debian` Docker image to
test and generate armhf builds.

We needed to add a slash before `build` in `.gitignore` given that git
was refusing to include any changes on `scripts/build` otherwise.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-28 11:26:36 -04:00
Juan Cruz Viotti
d8e31665a0 chore: follow standardjs guidelines (#1664)
- Extend the `standard` ESLint configuration
- Remove ESLint rules that are defined in the `standard` configuration
- Get rid of semi-colons

See: https://github.com/resin-io/etcher/pull/1657
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-03 09:01:54 -04:00
Juan Cruz Viotti
5c19b70e83 refactor: adhere mostly to StandardJS guidelines (#1657)
This commit changes the whole codebase to adhere to all StandardJS
guidelines rules except semicolons, since the removal of semicolons
affect pretty much all lines, and the final diff is very hard to follow
(and to assess other more involved changes).

In a nutshell:

- When using `function`, we now require a space before the opening
  parenthesis
- If a line with operators is broken into multiple lines, the operator
  should now go after the line break
- Unnecessary padding lines are now forbidden

There were also some minor things that the `standard` CLI caught that I
updated here.

See: https://standardjs.com
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-03 06:59:02 -04:00
Juan Cruz Viotti
b64ef705e8 chore: use old custom build system to create AppImages (#1625)
electron-builder seems to ship with an older AppImages version that
doesn't play very well with the custom AppImages elevation system we
created.

More particularly, we can't execute custom binaries inside the mounted
AppImage given that the mount point seems to lose permissions, owner,
and group file information.

This commit goes back to our old custom build system just for AppImages,
until we properly solve the problem, which will likely involve updating
the AppImages version in electron-builder.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-25 09:47:33 -03:00
Juan Cruz Viotti
09bf430a1e chore: remove the concept of target and host platforms (#1610)
Its very unlikely that we will ever support cross platform builds. For
that reason, let's simplify the whole Makefile by removing the concept
of target and host platforms.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-23 23:33:05 -03:00
Andrew Scheller
fa60a746a2 chore: fix typos in target-convert.sh (#1608) 2017-07-19 10:04:15 -03:00
Juan Cruz Viotti
be8a638fce chore: pass --quiet to pip install (#1592)
This helps reduce a bit of output in the CI servers.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 16:15:03 -04:00
Juan Cruz Viotti
ff547035be chore: only ignore top level directories in gitignore for some cases (#1588)
We accidentally added build/ to gitignore, causing any new files from
`scripts/build` to be ignored.

See: https://github.com/resin-io/etcher/pull/1547#discussion_r126790010
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 10:23:22 -04:00
Juan Cruz Viotti
6ffba92dc8 chore: make use of pkg to package the Etcher CLI (#1547)
This commit replaces our home-grown CLI packaging mechanism based on
browserify + node-static-entry-point with pkg, an open source tool to
package Node.js applications for distribution.

Some highlights:

- Removing browserify got rid of a lot of dependencies from
  npm-shrinkwrap.json

- pkg currently has an issue where macOS binaries can't be code-signed
  (https://github.com/zeit/pkg/issues/128), therefore this commit
  comments-out the binary signing section for that operating system

- pkg currently has an issue where Windows binaries can't be branded
  (https://github.com/zeit/pkg/issues/149), therefore this commit
  comments-out the branding section for that operating system

See: https://github.com/zeit/pkg
Fixes: https://github.com/resin-io/etcher/issues/1531
Fixes: https://github.com/resin-io/etcher/issues/1450
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-11 14:37:14 -04:00
Jonas Hermsmeier
5f5a4b61b0 chore(scripts): Silence stdout for npm install (#1567)
Change-Type: patch
2017-07-03 17:08:53 -04:00
Juan Cruz Viotti
c2563c2f87 chore(npm): move retry options to INSTALL_OPTS (#1564)
See: https://github.com/resin-io/etcher/pull/1550/files#r125015773
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-03 11:48:07 -04:00
Jonas Hermsmeier
2008c50ebf chore(scripts): Make npm output less verbose (#1554)
This adds the `--silent` flag to several npm commands,
ideally making the output less verbose, for better overview in CI logs.

Change-Type: patch
2017-06-27 22:27:34 +02:00
Juan Cruz Viotti
3ab989cf3c chore: increase npm retries and max timeout (#1550)
CI servers fail with timeouts, or network issues quite frequently,
requiring maintainers to manually restart failed builds.

Hopefully these npm settings will help mitigating these issues.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-27 13:11:54 -04:00
Juan Cruz Viotti
a7ac28b717 chore: make use of electron-builder to build GNU/Linux packages (#1520)
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-23 20:10:51 -04:00
Juan Cruz Viotti
a8f6275763 chore: generate single-binary portable installers on Windows (#1518)
We currently support portable builds that are basically ZIPs containing
the main Etcher executable and all its related libraries.

Turns out `electron-builder` supports NSIS-based portable builds that
can create a single executable that has everything it needs to run,
including any external assets.

This commit makes use of this new portable Windows installer
functionality, replacing the old ZIP approach.

Change-Type: patch
Changelog-Entry: Generate single-binary portable installers on Windows.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-15 12:10:22 -04:00
Juan Cruz Viotti
2f605497be chore: use electron-builder to generate macOS builds (#1511)
This commit makes use of electron-builder to replace what our scripts
were already doing.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-15 10:11:49 -04:00
Juan Cruz Viotti
07adafe6f3 chore: use the new electron-builder version to create NSIS installer (#1510)
We've been using `electron-builder` v2 all this time to create the NSIS
installer. This commit upgrade `electron-builder` to v18.6.2, and keeps
using it just to create the NSIS installer (for now).

The final package behaves exactly like the one we have before, just that
we needed various tweaks to upgrade to the latest `electron-builder`
version.

In more detail:

- Inject data to package.json using the new `--extraMetadata` option
- Remove old `.builder` package.json property
- Change the author of the project to Resin Inc. (the company name used
  in our code-signing certificate)

As an extra, the new NSIS installer allows the user to install the
application to any location, and fixes the fact that the previous
installer copied the application to C:\Program Files (x86) even on x64
systems.

Change-Type: patch
Fixes: https://github.com/resin-io/etcher/issues/1030
Fixes: https://github.com/resin-io/etcher/issues/877
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-13 11:19:29 -04:00
Juan Cruz Viotti
15b178a158 refactor(GUI): move ETCHER_DISABLE_UPDATES into package.json (#1501)
Etcher supports disabling the update notification dialog by setting the
`ETCHER_DISABLE_UPDATES` environment variable.

In order to simplify disabling updates for when these are managed by a
package manager (e.g. in a debian package), this removes support for the
`ETCHER_DISABLE_UPDATES` environment variable, and instead requires
packagers to tweak the `updates.enabled` property of the package.json
file, which is set to `true` by default.

We don't want to encourage end users to disable the update mechanism, so
the documention was removed from `USER-DOCUMENTATION.md`. This option
will remain as something only packagers should tweak.

Change-Type: minor
Changelog-Entry: Remove support for the `ETCHER_DISABLE_UPDATES` environment variable.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-13 09:07:47 -04:00
Andrew Scheller
22be831535 chore: move mkdir call from node-package-cli.sh to Makefile (#1516)
This makes it more consistent with the other Makefile rules
2017-06-13 14:00:43 +01:00
Dhruv Paranjape
f350d28dbd chore: Add support for rpm packages (#1425)
* add support for rpm packages.

* remove bintray file not my place neither do i have the keys.

* Remove last visage of publishing rpm's to bintray.

* address review comments.

* remove electron installer redhat from optional dependancies and add it to dockerfiles. also remove variable ELECTRON-INSTALLER-REDHAT inline with electron installer debian script.

* Add dependancy on libXScrnSaver and remove unsupported fields from config.json.
add rpm package to dockerfiles.
add dependancy check on rpmbuild to installer script.

* change dependancy from lsb-core-noarch to just lsb.

* address review comments.

* Add bintray target for rpm packages.

* Fix missing dependancy removed during conflict resolution.
2017-06-12 18:54:31 +01:00
Juan Cruz Viotti
296a554637
Revert "chore: make use of resin.io's Docker base images"
This reverts commit d39b4ba7d7687a7eea72cbf7b8702f8ea122fb39.
2017-05-31 10:51:27 -04:00
Juan Cruz Viotti
9a3900debb chore: make use of resin.io's Docker base images (#1481)
Resin.io already publishes multi-arch Docker base images running Jessie,
which is Debian version we wanted before falling back to Ubuntu 12.04.

The main reason behind this change is to be able to use other resin.io
base images (like ARM ones) without requiring a lot of per-base-image
changes.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-29 20:45:24 -04:00
Andrew Scheller
2e50ad802f chore(docker): Change APT mirror used by the Ubuntu12.04 32bit docker image (#1471)
Previously it was using http://ubuntu.stu.edu.tw but this host is no longer
active, which was causing all the 32bit Linux TravisCI builds to fail.
2017-05-25 19:06:18 +02:00
Juan Cruz Viotti
8e681b5534 fix(CLI): get rid of Browserify absolute path workaround (#1449)
We encountered a Browserify bug when releasing the CLI, where absolute
paths would be hard-coded in the final bundle. Since we were in the
middle of a release process, we added a quick and dirty
search-and-replace workaround on `concatenate-javascript.sh`.

After the release, we submitted a PR to Browserify which fixes the
issue. This commit makes use of my personal fork to be able to use such
fix while it gets merged to the main project.

See: https://github.com/substack/node-browserify/pull/1725
See: https://github.com/resin-io/etcher/pull/1409
Fixes: https://github.com/resin-io/etcher/issues/1429
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-22 11:33:09 -04:00
Juan Cruz Viotti
78f36dfd16 chore: track python dependencies with pip (#1447)
We're currently hardcoding various pip dependencies in
`appveyor-install.bat` and `travis-install.sh`.

This commit moves all the dependencies to a `requirements.txt` file in
the root of the project, and makes every install script run `pip install
-r requirements.txt`.

See: https://github.com/resin-io/etcher/pull/1401#discussion_r116547053
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-18 16:35:06 -04:00
Juan Cruz Viotti
a74e6b53cd chore: fix lzma-native not building for the x86 Linux CLI (#1448)
There are various problems that contributed to this issue:

- `node-pre-gyp` doesn't detect the 6.10.3 node version. We reverted to
  6.1.0, which the module recognised, and which shares the same v8 ABI

- Passing `--force` to `npm install` causes npm to swallow any errors
  and silently continue

- The x86 Docker container has problems writing to `$HOME/.node-gyp`.
  The solution is to enable `unsafe-perm` given that the container is
  running as `root`

Fixes: https://github.com/resin-io/etcher/issues/1444
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-17 17:10:00 -04:00
Andrew Scheller
57e29a5725 chore: Check for the commands used by electron-installer-debian (#1446) 2017-05-17 13:59:18 +01:00
Juan Cruz Viotti
369cfa7e88 refactor: address review comments from #1401 (#1433)
See: https://github.com/resin-io/etcher/pull/1401#pullrequestreview-37459059
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-15 13:17:51 -04:00
Juan Cruz Viotti
1048150654 chore: check that there are no unstaged shrinkwrap changes (#1379)
See: https://github.com/resin-io/etcher/pull/1372
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-15 12:58:20 -04:00
Juan Cruz Viotti
9c055fb165 fix(CLI): workaround absolute paths in Browserify bundles (#1409)
For some strange reason, Browserify will hardcode absolute paths from
the machine that generated the bundle to be able to resolve `__dirname`
and `__filename` calls. This makes no sense, given that it means that
the Browserify bundle will not work when we move it to another machine,
which went undetected probably for months.

The Browserify community apparently makes modules to fix this particular
issue (like `bundle-collapser`, and `intreq`), however none of this seem
to solve the problem for the Etcher CLI bundle.

I also gave https://github.com/zeit/pkg a go, however I gave up after
not being able to make use of native modules (nothing seems to work; the
packager result will simply not find the addons).

Finally, I ended up making the following workarounds:

- Edit the Browserify bundle file to use its own `__dirname` to
  dynamically resolve the values of `__dirname` and `__filename` of the
  files it contains

- Patch `lzma-native` to statically require its add-on rather than
  relying on dynamic requires from `node-pre-gyp`, which makes it
  impossible to resolve on the final bundle

See: https://github.com/resin-io/etcher/issues/355
See: http://stackoverflow.com/questions/21993073/browserify-with-paths-to-folders-in-my-system
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-11 15:37:45 -04:00
Juan Cruz Viotti
66547c5abd chore: replace wget with curl on node-static-entry-point-download.sh (#1406)
See: https://github.com/resin-io/etcher/pull/1365
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-10 19:28:12 -04:00
Juan Cruz Viotti
d521fbbd2c chore(CLI): minify Etcher CLI code (#1401)
UglifyJS v3 was recently released, which includes support for
compressing ES6 code.

This commit introduces the following changes:

- Add a boolean `-m` option to `concatenate-javascript.sh`, which when
  set, will minify the final concatenated JavaScript file

- Install `uglify-es` in the CI servers

See: https://news.ycombinator.com/item?id=14285179
See: https://github.com/mishoo/UglifyJS2/tree/harmony
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-10 15:15:41 -04:00
Juan Cruz Viotti
7ddc5d525c refactor: address code review comments from #1366 (#1390)
See: https://github.com/resin-io/etcher/pull/1366
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-09 19:33:45 -04:00
Juan Cruz Viotti
b75dfd3ece feat(GUI): implement Windows elevation using a native module (#1366)
Sentry error reports showcase that elevation errors on Windows are one
of the most frequent Windows errors.

In order to perform Windows elevation, we ship compiled EXEs of a third
party CLI elevation application (http://code.kliu.org/misc/elevate/)
that has several limitations:

- We have the scan the output of the script to determine if a user
  cancelled the elevation request, which causes all sorts of issues on
  computers where English is not the main language

- The application displays a `cmd.exe` window for some milliseconds,
  which is bad UX, that we have to workaround by distributing a patched
  version of the tool

- The CLI application has to be spawned, which seems to be problematic
  if users have anti-virus software, leading to hard to debug issues

- We don't have any control if something goes wrong

For these reasons, we decided to implement our own elevation mechanism
in C++ as a Node.js add-on, based on the `elevate.exe` code we where
previously using.

Misc changes:

- Introduce a `lib/shared/bindings.js` module to easily require local native
  add-ons

- Install `cpplint` and configure it to lint C++ files

Note that for practical reasons, the C++ code lives in this repository
rather than in a separate module. We will release this functionality in
a more accessible way in the future as part of the Etcher SDK project.

Change-Type: patch
Changelog-Entry: Fix uncaught errors when cancelling elevation requests on Windows when the system's language is not English.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-02 18:36:57 -04:00
Juan Cruz Viotti
09d2a9d897 chore: build on Ubuntu 12.04 Docker base images (#1364)
We recently discovered that users not running latest GNU/Linux
distributions were having problems when Etcher tried to load native
modules. We used to build packages on Ubuntu 16.04, which ships with
GLIBC 2.23.

In order to solve that issue, we moved our build Docker containers to
Debian Jessie, which ships with GLIBC 2.19, however we noticed that
users running even older Linux distributions were still having the same
issue, so this commit switched the Docker containers to Ubuntu 12.04,
which ships with GLIBC 2.15.

See: https://github.com/resin-io/etcher/pull/1319
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-28 12:43:38 -04:00
Juan Cruz Viotti
9acebda035 chore: make use of browserify as a development dependency (#1354)
This is causing all the snapshot builds to fail when a PR is merged to
master.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-26 11:06:23 -04:00
Juan Cruz Viotti
0f8ad15e45 chore(CLI): create basic CLI package installers (#1240)
This commit packages the Etcher CLI as a ZIP archive for Windows, and as
a tarball for GNU/Linux and macOS. These basic "installers" are the
foundation to provide Chocolatey/Brew/AUR/etc packages.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-21 12:17:36 -04:00
Juan Cruz Viotti
0aefa56e1d chore: make asar a development dependency (#1330)
To prevent any potential version incompatibility caused by simply installing
the latest version of the packages in the CI services.

See: https://github.com/resin-io/etcher/pull/1326
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 13:48:31 -04:00
Juan Cruz Viotti
b93fd86092 chore: perform GNU/Linux builds on Debian Jessie docker containers (#1319)
We recently hit an issue where Etcher builds produced on Ubuntu relied
on a too new glibc version, making them incompatible with GNU/Linux
distributions such as Debian Jessie.

As a solution, we will start producing builds on Debian Jessie, which
ensures that the builds will be compatible with the majority of
GNU/Linux versions out there.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 12:23:13 -04:00
Juan Cruz Viotti
880ca257a6 chore: make electron-installer-debian an optional dependency (#1326)
We currently require this module to be available in the environment in
order to be able to build debian packages.

This commit adds it as an optional dependency, so we can have control
over the version that we use, to prevent any potential incompatibility.

We also update the `udif` package.json version to match what its on the
shrinkwrap file to avoid npm complaining about version mismatches.

See: https://github.com/resin-io/etcher/pull/1290
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 12:06:53 -04:00
Juan Cruz Viotti
c3a41b172e chore: pass bintray environment variables to Docker containers (#1307)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 11:06:17 -04:00
David Lechner
588c94a64f chore: fix debian package run script (#1290)
The rc2 debian package is not working because the path where the package files
is installed has changed. The change in paths comes from an upstream change
in the electron-installer-debian node package. So, updating the path here to
match the actuall install location.
2017-04-13 13:38:54 -04:00
Andrew Scheller
57045ef1f6 chore: small tweak to the jq-insert.sh syntax (#1287) 2017-04-12 18:33:03 -04:00
Juan Cruz Viotti
2af129d0b7 chore: add analytics token environment variables to Docker container (#1274)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 23:49:53 -04:00
Juan Cruz Viotti
85e1bdb650 chore: fix jq crashing on Windows when using relative paths (#1276)
`jq` crashes when setting a value on a relative file. We workaround the
issue by using `jq` in a pipe instead of passing the file to it as an
argument.

See: https://github.com/stedolan/jq/issues/1155
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 23:49:46 -04:00