381 Commits

Author SHA1 Message Date
Jonas Hermsmeier
9b721d83dc
upgrade(package): Update drivelist 5.2.12 -> 6.0.0 (#1953)
* upgrade(package): Update drivelist 5.2.12 -> 6.0.0

This updates `drivelist` to incorporate the new native
bindings rewrite on Windows, fixing scanning errors.

Change-Type: patch
Changelog Entry: Fix "Couldn't scan drives" error

* test(drive-selection): Adjust to breaking drivelist changes

* fix(drivelist): Correct conditions in standard adapter

* refactor(usbboot): Adjust readonly & system flags

* doc(drive-constraints): protected -> isReadonly
2018-01-05 17:22:00 +01:00
Juan Cruz Viotti
2291321b46 refactor(GUI): remove the intermediate child writer proxy process (#1910)
Etcher currently elevates a child writer proxy that itself spawns the
Etcher CLI in robot mode, parses the output, and proxies those messages
to the GUI application over IPC.

After these set of changes, Etcher elevates a single child writer
process that directly communicates back with the GUI using IPC. The main
purpose behind these changes is to simplify the overall architecture and
fix various issues caused by the current complex child process tree.

Here's a summary of the changes:

- Stop wrapping the Etcher CLI to perform writing
- Remove the robot option from the Etcher CLI (along with related
  documentation)
- Elevate a new `child-write.js` standalone executable
- Move the relevant bits of `lib/child-writer` to the `image-writer` GUI
  module
- Remove the `lib/child-writer` directory
- Add a new "Child died unexpectedly" Mixpanel event
- Floor state percentage in the flash state model

The above changes made is possible to tackle all the remaining issues
where the writer process would remain alive even if the parent died.

Change-Type: patch
Changelog-Entry: Ensure the writer process dies when the GUI application is killed.
See: https://github.com/resin-io/etcher/pull/1873
See: https://github.com/resin-io/etcher/pull/1843
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2018-01-04 20:46:09 +01:00
Juan Cruz Viotti
cb876436d4 fix(shared): trailing space in Windows elevation env vars (#1949)
This is a strange one. On Windows, putting a space before the
double-ampersand command concatenator makes the environment variable
value contain a trailing space. So for something like `set foo=bar &&
...` the variable `foo` will be `'bar '` instead of `'bar'`.

Change-Type: patch
Changelog-Entry: Fix trailing space in environment variables during Windows elevation.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2018-01-04 12:47:10 +01:00
Benedict Aas
13758c9568
feat(GUI): remove angular from image-writer (#1680)
* feat(GUI): remove angular from image-writer

We remove Angular from the `image-writer` module by using Redux store
updates, subscribing to them while flashing.

Changelog-Entry: Remove Angular dependency from image-writer.
Change-Type: minor
2018-01-04 11:12:08 +00:00
Juan Cruz Viotti
f2c9404fc4
chore: setup a Spectron integration test suite (#1884)
- Add a `make test-spectron` target

- Install `spectron` and `mocha` (since we don't need to run the tests
  inside an Electron instance like in the case of `electron-mocha`)

- Add some example tests

Fixes: https://github.com/resin-io/etcher/issues/1870
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-12-13 13:51:16 -04:00
Andrew Scheller
701893b472
fix(s3): Fix EAI_AGAIN error at startup with no internet connection (#1855)
Change-type: patch
2017-11-17 11:22:22 +00:00
Jonas Hermsmeier
5e77958106
feat(writer): Implement streaming pipelines (#1671)
This implements a new way of image write streaming under use of pipage and blockmap, which paves the way for a few things like using network locations as sources, and imaging of storage devices (aka backups). As it allows for mutation of the streaming pipeline while it's writing, it also facilitates the development of dynamic block-mapping.

Change-Type: minor
2017-11-14 19:54:10 +01:00
Benedict Aas
0058919a8e
feat(GUI): add progress and status to window title (#1438)
* feat(GUI): add progress and status to window title

We add the progress percentage to the window alongside the status
(validating, flashing).

Closes: https://github.com/resin-io/etcher/issues/1427
Fixes: https://github.com/resin-io/etcher/issues/1439
Changelog-Entry: Add the progress and status to the window title.
2017-11-14 09:23:41 +00:00
Andrew Scheller
26b521411f
fix: Correct image.size usage in tests and code-comments (#1833)
image.size is always an object, never a plain number

Change-type: patch
2017-11-08 16:53:57 +00:00
Jonas Hermsmeier
68f3f695cd
feat(sdk): Implement continuous scanning (#1814)
This implements an SDK.Scanner which handles any given
adapters and manages the scans. This change enables continuous
scanning without the need to `.scan()` scheduling in other places.

Change-Type: minor
2017-10-31 18:05:32 +01:00
Juan Cruz Viotti
02f7a5f55b refactor(SDK): make adapter scan functions event based (#1781)
* refactor(SDK): make adaptor scan functions event based

This change will allow us to start emitting progress events out of the
adaptors scan functions.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

* refactor(sdk): Make adapters event emitters
2017-10-25 13:26:43 +02:00
Juan Cruz Viotti
0f8043b35b fix(GUI): don't show the "too small" badge if the size is null (#1779)
Some devices don't have a size, like USB devices in the usbboot adaptor.
The `.isDriveLargeEnough()` correctly returns `false` in this case,
however we don't want to show the `TOO SMALL` badge for aesthetics
purposes.

So if a drive has a size that equals `null`, we don't allow such drive
to be selected, and we don't show a badge for it.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-10-16 17:51:55 +01:00
Juan Cruz Viotti
444072db13 refactor(GUI): generalize the concept of a "pending" drive (#1777)
This commit introduces a boolean `disabled` property rather than a
`pending` flag. Making this distinction clearer means that we can now
treat pending drives in different ways needed to improve the usbboot
experience.

Also, for usbboot, this commit removes the "pending" badge and uses a
more descriptive drive description instead.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-10-16 12:09:38 +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
Jonas Hermsmeier
3147a93ca6 feat(image-stream): Support .bin image extension (#1750)
This adds support for selecting images with a `.bin` file extension.

Change-Type: minor
Closes #1739
2017-10-03 18:13:02 +02:00
Jonas Hermsmeier
b5912eb9f6 fix: Support raw images without secondary file extension (#1724)
This allows selection of images without a secondary file extension
(i.e. `example.gz`, compared to `example.img.gz`) by defaulting to `img`
in the image-stream handlers, should no secondary extension be found.

Further this adjusts `.getPenultimateFileExtension()` to return `null`
if the detected penultimate extension is not a known file extension.

Change-Type: patch
2017-09-13 18:34:26 +02:00
Juan Cruz Viotti
7b791d622f feat(GUI): support new "pending" drive flag (#1709)
We recently added a "pending" flag to all drives that represents whether
the drive is ready for selection or not. This flag will be used by the
"usbboot" flashing adaptor, which will emit various "pending" USB
devices while it converts them to block devices that can actually be
flashed.

In terms of the GUI, the following visible changes were made:

- Drives with a `pending: true` property will be disabled in the drive
  selector window
- Drives with a `pending: true` property have a "PENDING" red badge

See: https://github.com/resin-io/etcher/pull/1707
See: https://github.com/resin-io/etcher/pull/1686
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-24 19:56:12 -04:00
Juan Cruz Viotti
f3c8ec496a test(shared): ensure drive objects can contain extra properties (#1705)
The usbboot integration will bring in drive objects that include a lot
more properties than the current drive objects. This commit ensures that
the redux store can handle those extra properties.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-24 19:27:38 -04:00
Juan Cruz Viotti
9f4712f1f8 refactor: use an SDK orchestrator to implement drive scanning (#1707)
This is a major first step towards adopting an SDK architecture. This
commit creates an SDK adaptor with a `.scan()` function that uses
`drivelist` under the hood. Then, an SDK orchestrator is used to provide
drive scanning capabilities to the GUI.

Here's a list of some particularly interesting changes:

- The drives returned by the SDK adaptor now have a "pending" and an
  "adaptor" property. The "pending" property is a boolean flag that
  determines if the drive is ready to be used (this will come handy for
  usbboot), while the "adaptor" property simply contains the name of the
  adaptor that drive came from

- The GUI drive scanner Rx implementation was replaces with a "promise
  loop." Before, the drive scanning routine would be called every 2
  seconds (without waiting for the previous scan to complete), while
  now, the next scan happens *after* the previous scan completes. For
  this reason, I reduced the drive scanning interval timeout to match
  the timing we had before

Change-Type: patch
See: https://github.com/resin-io/etcher/pull/1686
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-24 17:24:48 -04:00
Juan Cruz Viotti
5196ac8d32 refactor: simplify release type handling within the app (#1667)
As another step towards moving to GitHub Releases, this commit makes the
application care much less about the actual release type of the current
version, instead checking if the application is stable or not, which is
more aligned to what GitHub provides us.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-09 08:43:19 -07:00
Juan Cruz Viotti
79a7a03d03 chore: enforce single quotes in ESLint (#1679)
We recently adopted the standardjs guidelines ESLint, which doesn't seem
to enforce single quotes, even though the guidelines mention it.

See: https://github.com/resin-io/etcher/pull/1663#discussion_r131623802
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-08 08:42:04 -07:00
Jonas Hermsmeier
a2f1ddddb5 fix(svg-icon): Handle DOMParser parsererrors (#1663)
This checks for `parsererror`s in the DOMParser's returned document,
to prevent re-use of the previous image and avoid displaying an error
document in the SVG icon slot.

Change-Type: patch
Changelog-Entry: Avoid "broken" icon when selecting a zip image archive with invalid SVG.
2017-08-07 07:29:30 -07:00
Benedict Aas
de63d534c5 fix(GUI): make disabled svgs work in img tags (#1661)
SVGs are displayed through IMG tags, but these do not support CSS
`fill`, and as such we work around it with `opacity`.
2017-08-03 12:30:00 -04:00
Juan Cruz Viotti
269aafd625 fix(GUI): log known user errors when querying S3 for updates (#1655)
We send an HTTP request to S3 to determine the latest available version.
There are various error that can happen that we don't have control over
(like `ETIMEDOUT`).

The current approach is to whitelist certain errors and pretend there is
no update available, however this commit improves that whole situation.

Instead of swallowing these errors, we throw a user error from the
function that determines the latest available version. From the
application code, we check if that function throws a user error, and if
so, instead of showing it to the user, we log a mixpanel event and carry
on.

This change is motivated by the latest reporter error we can't do
anything about: `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`.

Fixes: https://github.com/resin-io/etcher/issues/1525
Change-Type: patch
Changelog-Entry: Fix `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` error at startup when behind certain proxies.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-03 10:23:34 -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
f05b28218c fix: ignore EHOSTDOWN errors when querying S3 (#1654)
There's not much we can do if we can't connect to S3 to determine the
latest available versions when checking if we should show an update
notification dialog or not.

As with similar errors, lets swallow this particular one, and try again
the next time Etcher runs.

Change-Type: patch
Changelog-Entry: Fix `EHOSTDOWN` error at startup.
Fixes: https://github.com/resin-io/etcher/issues/1645
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-02 10:12:45 -04:00
Benedict Aas
70ad86534d feat(GUI): make size units closest relative (#1539)
We make the size units used the closest relative unit through a new
filter `closestUnit` replacing the old `gigabyte` filter.

Changelog-Entry: Round byte sizes to the more appropriate unit.

* remove filters folder

* new shrinkwrap, add to package.json

* test
2017-08-01 17:34:13 -04:00
Benedict Aas
7714e8b50a fix(GUI): make archive-embedded svgs work again (#1642)
We make the svg-icon component accept XML in its path argument to handle
archive-embedded SVG icons.

Changelog-Entry: Make archive-embedded SVG icons work again.
Fixes: https://github.com/resin-io/etcher/issues/1636
2017-08-01 12:34:06 -04:00
Juan Cruz Viotti
a63b6bf18c fix(CLI): pass required arguments to flashComplete message (#1630)
The `flashComplete` message takes the drive object and the image
basename as arguments. This was updated on the GUI, but causes the CLI
to throw an error upon completion.

Change-Type: patch
Changelog-Entry: Fix "imageBasename is not defined" error on the CLI.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-01 12:32:50 -04:00
moragues
70c79f6127 feat: support rpi-sdcard image file type (#1648)
Support the rpi-sdcard image file type output by Yocto for
the Raspberry Pi device.

Change-Id: Ia7e3aef0d90fdf21d373a560e6dd2b96e6b51da8
Changelog-Entry: Add support for `.rpi-sdcard` images.
2017-08-01 10:34:25 -04:00
Juan Cruz Viotti
fc3eeff1c9 refactor(GUI): make settings model setter asynchronous (#1597)
This is part of the process of implementing support for a configuration
file. We previously decoupled the Redux store from localStorage by
moving the logic that actually persists the data to localStorage to a
local-settings.js file, however the localStorage API is synchronous, so
it follows that at the moment, all functions that interact with are also
synchronous.

Moving to storing the settings to a file means turning all these
functions to promises, which we do in this commit, in order to not mix
the addition of the configuration file feature with the huge amount of
refactoring it requires.

See: https://github.com/resin-io/etcher/issues/1356
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-01 10:27:15 -04:00
Jonas Hermsmeier
36664fb251 fix(writer): Use final size if it's not an estimation (#1587)
This avoids running into the "flashstate percentage above 100%" error again.

Change-Type: patch
Changelog-Entry: Prevent "percentage above 100%" errors on DMG images.
2017-07-24 16:54:02 -03:00
Juan Cruz Viotti
4122e0bf1d refactor: move most models to lib/shared/ (#1596)
Now that the Redux store is no longer front-end dependent, we can move
most of the models to lib/shared. Currently, lib/shared is a mess, and
contains all sorts of functionality, however moving things out of the
GUI is the first step. Once we have everything decoupled, we can
organise all the code we have there.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-18 12:34:10 -03:00
Juan Cruz Viotti
37b7ea3b0a refactor(image-stream): extract part of utils.js into mime.js (#1594)
This is a small refactoring commit that extracts the MIME related
function from utils.js into a new file called mime.js, and stores the
default image MIME type there as a constant, to avoid duplicating it in
multiple parts of the code.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-14 19:59:33 -04:00
Juan Cruz Viotti
a772877ae1 test(image-stream): move extraction timeout to a shared constant (#1599)
The image stream tests that extract images all have a 20s timeout, which
is manually set in all the suites related to extraction.

This commit extracts that number as a constant called DEFAULT_TIMEOUT.

See: https://github.com/resin-io/etcher/pull/1595
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-14 19:59:25 -04:00
Juan Cruz Viotti
2a8e91190c test(image-stream): increase DMG tests timeouts (#1595)
I caught an sporadic issue a couple of times, where the DMG tests would
exceed the default 2000ms mocha timeout. All the other image
decompression tests have a much higher timeout already, so this commit
adds the same timeout to the DMG tests file.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 17:41:44 -04:00
Juan Cruz Viotti
fdceaadec5 refactor(GUI): move redux store to lib/shared (#1576)
After https://github.com/resin-io/etcher/pull/1569, the redux store can
run outside of a browser context. This commit moves it to `lib/shared`,
where we will likely move all the other models as well. As an extra, I
renamed `Store` to `store`, since there was no reason for that variable
to be capitalized.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-07 18:47:39 -04:00
Juan Cruz Viotti
4dc56f4678 refactor(GUI): decouple localStorage from the redux store (#1569)
We're currently persisting the user settings in localSettings by using a
redux plugin called redux-localstorage. As a way to decouple the redux
store from a technology that is browser specific, this commit makes the
following changes:

- Create local-settings.js, which is concerned with managing settings in
  a persisting location

- Decouple the redux store from the persisting storage method

- Extend the settings model to persist settings, cache reads, etc

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-06 17:49:13 -04:00
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
Jonas Hermsmeier
f1ddf07a45 test(image-stream): Test more compression methods (#1565)
* test(image-stream): Add more zip compression methods
* test(image-stream): Add more dmg compression methods
* test(image-stream): Add bz2 level 9 test

Change-Type: patch
2017-07-03 23:35:06 +02:00
Jonas Hermsmeier
a370e9d4cb feat(gui): Show friendlier error dialog when opening images (#1557)
* feat(gui): Friendly error dialog when opening image fails

This displays a friendlier error dialog if opening an image fails
due any reason (like i.e. an unsupported compression method)

Change-Type: patch

* test(image-stream): Add test for unsupported compression method
* test(image-stream): Only check `error.description` when given
* test(image-stream): Add zip-deflate64.zip
2017-06-28 16:44:21 +02:00
Jonas Hermsmeier
4f4c606949 test(image-stream): Fix test image data (#1535)
This updates the base test image to be a complete, but small
disk image, as thre previous image was quite large for running tests (32MB),
and was chopped off at an arbitrary position, causing other tools to fail
on it as an input.

Change-Type: patch
2017-06-21 16:31:21 +02:00
Juan Cruz Viotti
103a048e4d refactor(GUI): replace SET_SETTING with an atomic SET_SETTINGS action (#1515)
This commit is the first on a series of commit to incrementally
implement support for configuration files (so we avoid a huge PR like we
have at the moment).

Once of the first things we can do is replace the `SET_SETTING` redux
action with an atomic `SET_SETTINGS` action that sets all the settings
for the application at once.

The purpose of this change is that later the `SET_SETTINGS` action can
be modified to stringify all the settings and store them in a
configuration file, without having to deal with merges, conflicts, etc
(since the client application if forced to resolve those problems before
calling the `SET_SETTINGS` action.)

The behaviour of the code remains almost the same, with the exception
that the user can now set settings that we don't know about, so the user
can switch between Etcher versions without getting weird errors if one
of the configuration keys he has doesn't exist in the other version.

See: https://github.com/resin-io/etcher/pull/1382
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-15 12:57:15 -04:00
Benedict Aas
0f600c3cc2 refactor(GUI): remove angular dependency from drive scanner (#1512)
Remove the Angular dependency from DriveScanner and with it the service,
exposing it through the module directly.
2017-06-15 11:26:03 -04:00
Benedict Aas
a7d713c323 feat(GUI): rewrite svg-icon directive in react (#1464)
We change from using an Angular directive to using React through
react2angular in the SVGIcon module.
2017-06-12 08:42:52 -04:00
Benedict Aas
ef739fb222 refactor(GUI): remove angular dependency from selection-state (#1509)
We remove the dependency on Angular from SelectionStateModel and rename
it to selectionState.
2017-06-12 08:40:52 -04:00
Romain Bazile
a3c13e75cf feat: support .sdcard images (#1493)
Change-Type: minor
Changelog-Entry: Add support for `.sdcard` images.
Link: https://github.com/resin-io/etcher/issues/1360
Fixes: https://github.com/resin-io/etcher/issues/1348
Fixes: https://github.com/resin-io/etcher/issues/1361
2017-06-06 12:57:55 -04:00
Benedict Aas
14b04413b5 refactor(GUI): remove angular from DrivesModel (#1265)
We remove usage of Angular from DrivesModel.

Depends: https://github.com/resin-io/etcher/pull/1261
Depends: https://github.com/resin-io/etcher/pull/1264

* remove angular injection from tests

* move file

* add empty array test
2017-06-05 10:30:58 -04:00
Juan Cruz Viotti
dc2212a57f fix(GUI): ignore UNABLE_TO_VERIFY_LEAF_SIGNATURE HTTP issues (#1473)
This error may get thrown when fetching the list of S3 packages when the
user is behind a proxy tht causes the SSL certificate to incorrectly not
be trusted.

See: https://github.com/atom/apm/issues/103
See: https://github.com/resin-io/etcher/issues/1465
Change-Type: patch
Changelog-Entry: Fix `UNABLE_TO_VERIFY_LEAF_SIGNATURE` error at startup.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-06-05 10:22:15 -04:00