586 Commits

Author SHA1 Message Date
Jonas Hermsmeier
80b588683e feat(image-stream): Read MBR & GPT in .getImageMetadata() (#1248)
* feat(image-stream): Read MBR & GPT in .getImageMetadata()
* feat(gui): Display warning when image has no MBR
* test(image-stream): Update .isSupportedImage() tests
* feat(image-stream): Normalize MBR & GPT partitions
* test(image-stream): Add partition info
* feat(image-selection): Send missing part table event
* test(image-stream): Add GPT test image

Change-Type: minor
2017-07-05 16:18:02 +02:00
Juan Cruz Viotti
53d8118b8f chore: don't remove optional dependencies in clean-shrinkwrap.js (#1551)
If we include a platform specific optional dependency in the shrinkwrap
file, then npm will insist in installing it even if the platform doesn't
match. As a solution, we figured out we can avoid putting this platform
specific optional dependencies in the npm-shrinkwrap.json file.

In order to do this, we currently have a script called
`clean-shrinkwrap.js` that runs *before* any `npm shrinkwrap` file (its
a `preshrinkwrap` npm script) that deletes all the platform specific
modules we know about using `npm rm`.

The problem with this approach is that `npm rm` will remove the module's
code from `node_modules`, which means that if we run `npm shrinkwrap`,
we will lose certain optional dependencies, that may be needed at a
later stage.

The solution is to modify the `clean-shrinkwrap.js` script to parse
`npm-shrinkwrap.json`, and manually delete the entries that we want to
omit. Also, the script needs to be run *after* `npm shrinkwrap`, so we
change the npm script name to `postshrinkwrap`.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-03 10:30:04 -04:00
Juan Cruz Viotti
d8e9cb93b7 chore: move all electron-builder configuration to electron-builder.yml (#1544)
The electron-builder configuration we're putting in package.json is
growing. To make it easier to read and edit, we'll move the whole
`build` property into a configuration file called
`electron-builder.yml`.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-27 10:15:38 -04:00
Juan Cruz Viotti
cd4cff7e43 chore: remove npm ranges from package.json (#1549)
We don't make use of npm ranges at all (every dependency and its
subdependencies are shrinkwrapped). Removing npm ranges allows us to
simplify our clean-shrinkwrap.js script to get rid of platform specific
optional dependencies, and their subdependencies.

See: https://github.com/resin-io/etcher/pull/1514
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-26 18:49:51 -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
840388e8c5 chore: don't extract native dependencies out of the asar (#1542)
Turns out add-ons are loaded just fine from the asar now.

See: https://github.com/electron-userland/electron-builder/issues/1723
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-23 18:57:57 -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
Juan Cruz Viotti
cff445b64b chore: move npm targets to Makefile (#1505)
We currently have various npm script target, and some of them are
getting complex enough that making sense out of them in package.json is
not a trivial task.

This commit moves all npm targets that are not directly recognisable by
npm (like `start`, `test`, `preshrinkwrap`, etc) into the Makefile.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-10 13:50:29 -04:00
Juan Cruz Viotti
b16f9cfdf7 chore: re-organize package.json in a way similar to electron-builder (#1504)
This commit re-organizes various metadata properties in package.json so
that the structure better matches what `electron-builder` expects, to
ease the transition.

- Move `.companyName` to the Makefile (we don't need this in
  package.json)
- Move `.displayName` to `.build.productName`
- Move `.copyright` to `.build.copyright`
- Move category to `.build.mac.category`
- Move bundle id to `.build.appId`

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-10 13:37:44 -04:00
Juan Cruz Viotti
9bab3054e9 chore: remove ampersand from package description (#1503)
The ampersand confuses nupkg when generating Windows installers from
`electron-builder`.

The referenced issue talks about an issue where the ampersand is present
on the application name, but anything that gets into the `.nuspec` XML
file, including the description, triggers the issue.

See: https://github.com/electron-userland/electron-builder/issues/517
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-09 15:46:08 -04:00
Juan Cruz Viotti
927a0aba06 chore: remove unused electron-packager dependency (#1502)
We're not using this development dependency anymore. Furthermore, we're
also not using the `packageignore.js` script, which was meant to be used
with `electron-packager`.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-08 15:08:37 -04:00
Juan Cruz Viotti
8811bbed09 upgrade: drivelist to v5.0.22 (#1500)
- https://github.com/resin-io-modules/drivelist/pull/168

Change-Type: patch
Changelog-Entry: Fix occasional increased CPU usage because of perl regular expression in macOS.
Fixes: https://github.com/resin-io/etcher/issues/1288
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-08 13:36:57 -04:00
Jonas Hermsmeier
ce50364b9f upgrade(package): Update node-sass to 4.5.3 (#1489)
This updates node-sass from v3.x to v4.x in anticipation
of addition of Electron ABI versions in an upcoming version.

Change-Type: patch
2017-06-05 18:38:19 +02:00
Jonas Hermsmeier
fe40e7bdf1 chore(package): Update mountutils to 1.2.0 (#1488)
This updates `mountutils` from 1.0.6 to 1.2.0, which includes
various fixes and adds AsyncWorkers:

- fix(windows): Replace use of `wsprintf()`
- fix(darwin): Add local context to avoid global state
- feat(src): Use Nan::AsyncWorker

Change-Type: upgrade
2017-06-04 15:17:07 +02:00
Juan Cruz Viotti
1e169315fd refactor(GUI): turn the update notifier modal into a native dialog (#1359)
Electron v1.6.1 introduced checkbox support to the native message
dialog, giving us everything that was needed to implement the update
notifier modal using a native dialog.

This change allows us to get rid of a lot code.

See: https://github.com/electron/electron/pull/8590
Change-Type: patch
Changelog-Entry: Turn the update notifier modal into a native dialog.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-23 19:06:35 -04: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
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
3203eb5eda
v1.0.0
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-12 01:09:35 -04:00
Benedict Aas
2c26b4c6ac feat(GUI): dynamic finish page (#1368)
* feat(GUI): dynamic finish page

We implement an externally loaded dynamic finish page in React with
`react2angular`. If the Internet connection is unreliable or unavailable, or a
non-200 HTTP response is returned we display a fallback default finish banner.

Change-Type: minor
Changelog-Entry: Implement a dynamic finish page.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-12 01:07:24 -04:00
Juan Cruz Viotti
159cc24e78 upgrade: resin-cli-visuals to v1.3.1 (#1404)
This version upgrades `drivelist` to v5.0.20, which inlines the scripts
as a JSON file.

See: https://github.com/resin-io-modules/resin-cli-visuals/pull/41
See: https://github.com/resin-io-modules/resin-cli-visuals/blob/master/CHANGELOG.md
See: https://github.com/resin-io/etcher/issues/355
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-10 18:02:15 -04:00
Juan Cruz Viotti
78705165f0 upgrade: drivelist to v5.0.20 (#1402)
This version includes the following fix:

- https://github.com/resin-io-modules/drivelist/pull/164

The above change is also a huge step forward to finalizing the Etcher
CLI packaging story.

See: https://github.com/resin-io/etcher/issues/355
See: https://github.com/resin-io-modules/drivelist/blob/master/CHANGELOG.md
Fixes: https://github.com/resin-io/etcher/issues/1395
Change-Type: patch
Changelog-Entry: Fix error on startup when Windows username contained an ampersand.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-10 15:19:35 -04:00
Juan Cruz Viotti
ecb8dd29b7 upgrade: etcher-image-write to v9.1.3 (#1400)
This version gets rid of the `diskpart` optional dependency:

- https://github.com/resin-io-modules/etcher-image-write/pull/101

which will simplify the way we manage our `npm-shrinkwrap.json` file.

See: https://github.com/resin-io/etcher/pull/1379
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-10 11:47:44 -04:00
Juan Cruz Viotti
91784d6380 chore(codespell): add rpi-sdcard to the list of ignored extensions (#1377)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-07 14:58:40 -04:00
Juan Cruz Viotti
63fdb18286
v1.0.0-rc.5 2017-05-02 18:40:32 -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
79d5f0e90c chore: remove etcher-latest-version from package.json (#1372)
This version is no longer used, and was removed from the shrinkwrap
file, but for some reason, we forgot to remove it from package.json.

See: https://github.com/resin-io/etcher/pull/1183
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-01 19:38:52 -04:00
Juan Cruz Viotti
d3b35742a6 refactor(GUI): integrate etcher-latest-version into the main repo (#1183)
`etcher-latest-version` was kept in a separate repository in order to
re-use it with the Etcher website, however the Etcher website is not
using it at all, and we're moving towards having the website in the main
repository.

Therefore, this commit brings back the logic from
`etcher-latest-version`, but introduces it as
`lib/shared/s3-packages.js`, in order to not tie ourselves to the
AngularJS framework, and as a step towards the Etcher SDK.

As a nice little bonus, this commit adds support for an
`ETCHER_FAKE_S3_LATEST_VERSION` environment variable that can be used to
trick Etcher that there is an available update, and therefore show the
update notifier modal.

Also, this commit adds support for snapshot builds update-checks, by
checking the `resin-nightly-downloads` S3 bucket if the current version
contains a git commit hash build number.

If the version is not a production release, then the update notifier
modal doesn't present the checkbox to disable update notifications for X
days.

We also add a property called `updates.semverRange` to `package.json`,
which can be used to fine control which versions are considered as
candidates for an update notification.

This commit adds a setting called `includeUnstableChannel`, which can be
used to tweak whether unstable (beta) releases are considered or not
when checking for the latest available version.

See: https://github.com/resin-io-modules/etcher-latest-version
Fixes: https://github.com/resin-io/etcher/issues/953
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-26 23:52:04 -04:00
Juan Cruz Viotti
bc01e151c4 upgrade: electron to v1.6.6 (#1357)
Some changes that we're particularly interested in:

- https://github.com/electron/electron/pull/8590
- https://github.com/electron/electron/pull/8852
- https://github.com/electron/electron/pull/7631

Note that the `electron-prebuilt` packaged has been renamed to
`electron`.

Change-Type: patch
Changelog-Entry: Upgrade Electron to v1.6.6.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-25 15:52:19 -04:00
Juan Cruz Viotti
0668f424e1
v1.0.0-rc.4 2017-04-22 20:42:40 -04:00
Ștefan Daniel Mihăilă
9e7e5de63a feat(GUI): add uuid to flash events (#1344)
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-22 20:40:05 -04:00
Juan Cruz Viotti
78ab59a55e upgrade: mountutils to v1.0.6 (#1345)
- https://github.com/resin-io-modules/mountutils/pull/26

Change-Type: patch
Changelog-Entry: Fix "Unmount failed" on Windows where the PC is connected to network drives.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-22 12:07:31 -04:00
Jonas Hermsmeier
4023fe5b59 chore(package): Update udif to 0.9.0 (#1346)
This updates `udif` from 0.8.0 -> 0.9.0, fixing a stall when flashing
certain dmg images due to `UDIF.ReadStream()` overrunning block regions.

See https://github.com/jhermsmeier/node-udif/issues/5

Change-Type: patch
Changelog-Entry: Fix stall / freezing when flashing certain dmg images.
Connects To: #1342
2017-04-22 12:07:22 -04:00
Juan Cruz Viotti
cf99a5d598 upgrade: etcher-image-write to v9.1.2 (#1339)
- https://github.com/resin-io-modules/etcher-image-write/pull/99
- https://github.com/resin-io-modules/etcher-image-write/pull/98

See: https://github.com/resin-io-modules/etcher-image-write/blob/master/CHANGELOG.md
Change-Type: patch
Changelog-Entry: Show user friendly messages for `EBUSY, read` and `EBUSY, write` errors on macOS.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-21 17:41:13 -04:00
Juan Cruz Viotti
8057041bc7 chore: lock optional dependencies versions (#1337)
Optional dependencies (and their dependencies) are not tracked by the
shrinkwrap file. In order to prevent incompatibilities, we lock the
versions of all optional dependencies.

See: https://github.com/resin-io/etcher/pull/1304
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-21 12:03:39 -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
14a28fedcc upgrade: elevator to v2.2.3 (#1331)
This version contains a fix where an elevation error was not yielded
correctly.

See: https://github.com/resin-io-modules/elevator/pull/12
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 13:44:12 -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
2ec2ceea14 upgrade: drivelist to v5.0.19 (#1327)
- https://github.com/resin-io-modules/drivelist/pull/161
- https://github.com/resin-io-modules/drivelist/pull/156
- https://github.com/resin-io-modules/drivelist/pull/153

Change-Type: patch
Changelog-Entry: Various fixes for when drive descriptions contain special characters.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 10:49:40 -04:00
Ștefan Daniel Mihăilă
24fe1a6c89 upgrade: resin-corvus to 1.0.0-beta.26 (#1321)
This version solves the issue regarding some messages
getting console logged (and reaching Sentry) as "[object Object]".

Change-Type: patch
Changelog-Entry: Upgrade `resin-corvus` to 1.0.0-beta.26.
2017-04-19 11:07:50 -04:00
Juan Cruz Viotti
31aa73ce07
v1.0.0-rc.3 2017-04-15 00:18:35 -04:00
Juan Cruz Viotti
847b41f49a upgrade: etcher-image-write to v9.1.1 (#1306)
This version includes a fix to throw an `EUNPLUGGED` error instead of an
`UNKNOWN` one when unplugging an SD Card from an internal reader on
Windows.

Change-Type: patch
Changelog-Entry: Fix "UNKNOWN: unknown error" error when unplugging an SD Card from an internal reader on Windows.
See: https://github.com/resin-io-modules/etcher-image-write/pull/97
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 23:45:21 -04:00
Juan Cruz Viotti
e4a47611c0 upgrade: elevator to v2.2.2 (#1304)
This version prints debug messages to `stdout`.

See: https://github.com/resin-io-modules/elevator/pull/11
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 22:18:54 -04:00
Juan Cruz Viotti
ebd2d85de7 upgrade: mountutils to v1.0.5 (#1302)
This version accepts a `MOUNTUTILS_DEBUG` environment variable to make
the module output extra logging information, which we enable in this
commit as well.

See: https://github.com/resin-io-modules/mountutils/pull/25
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 14:59:27 -04:00
Juan Cruz Viotti
c5a9a1fca4 fix(GUI): show a friendly message when the drive is unplugged half-way through (#1301)
This commit shows a user friendly message when Etcher loses access to
the drive while flashing/validating, and prevents the cryptic errors
from getting to Sentry.

See: https://github.com/resin-io-modules/etcher-image-write/pull/96
Change-Type: minor
Changelog-Entry: Show a user friendly message when the drive is unplugged half-way through.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 14:24:06 -04:00
Juan Cruz Viotti
468312b6cc upgrade: elevator to v2.2.1 (#1300)
This version improves the error message if the elevate.exe utility
failed.

See: https://github.com/resin-io-modules/elevator/pull/10
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 13:17:18 -04:00
Ștefan Daniel Mihăilă
8edc41dee0 upgrade: resin-corvus to 1.0.0-beta.25 (#1299)
This version handles better non-error objects sent to Sentry.

Change-Type: patch
Changelog-Entry: Improve error reporting accuracy.
2017-04-14 12:38:20 -04:00
Juan Cruz Viotti
5535111314 upgrade: elevator to v2.2.0 (#1298)
This version contains a patch to output debugging information.

See: https://github.com/resin-io-modules/elevator/pull/9
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 12:27:19 -04:00