839 Commits

Author SHA1 Message Date
Juan Cruz Viotti
95d4f2f608 fix(GUI): prevent flashing the drive where the source image is located
Currently Etcher will allow you to flash an image to the same drive that
contains the image. As a way to protect against that case we introduce
the concept of a "source drive", which means a drive that contains the
source image.

This commit adds the following logic around this new concept:

- Don't auto-select a source drive
- De-select an already selected drive if an image inside it is selected
- Disable the drive in the drive selector modal
- Add a "Source Drive" badge to the drive in the drive selector modal

Fixes: https://github.com/resin-io/etcher/issues/830
Change-Type: minor
Changelog-Entry: Prevent flashing the drive where the source image is located.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:53:08 -04:00
Juan Cruz Viotti
16340b412a doc: workaround to npm shrinkwrap development dependencies bug
There are some npm versions that for some strange reason will attempt to
put *every* single development dependency in the `npm-shinkwrap.json`
file when editing the dependencies list.

This commit describes a workaround I've found to ensure only production
dependencies are added to the file.

I also renamed our `npm run shrinkwrap` script to `npm run
clean-shrinkwrap` since in some recent versions of npm, running `npm
shrinkwrap` will trigger our custom script instead of the original
implementation.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:52:40 -04:00
Juan Cruz Viotti
0187cb0b2d upgrade: drivelist to v5.0.8 (#1060)
Change-Type: patch
Changelog-Entry: Fix 'MySQL' is not recognised as an internal or external command error on Windows.
See: https://github.com/resin-io-modules/drivelist/issues/133
Fixes: https://github.com/resin-io/etcher/issues/1025
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-30 10:03:04 -04:00
Juan Cruz Viotti
fd9d3ce749
Revert "refactor: remove extended archives extra functionality (#1055)"
This reverts commit b78473ea0ebd76233217fb4f236bb34be635da90.
2017-01-26 18:36:33 -04:00
Juan Cruz Viotti
b78473ea0e refactor: remove extended archives extra functionality (#1055)
We currently attempt to read extra metadata from ZIP files, such as a
logo, image name, image url, etc. In order to simplify the metadata
story, we decided that this metadata will not live on the image itself,
but rather on a centralised repo, which greatly simplified our custom
archive extraction logic and allows us to make use of these nice
features even when streaming the image directly from the internet.

We'll be working on bringing back this functionality from a centralised
repo in subsequent commits.

Change-Type: major
Changelog-Entry: Remove extended archives metadata extraction logic.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-26 15:21:01 -04:00
Juan Cruz Viotti
1bfcee06e2 refactor(image-stream): stream original/final sizes (#1050)
The `image-stream` module currently returns a readable stream, a
transform stream, a "size", and an optional "estimatedUncompressedSize".

Based on this information, its hard to say what "size" represents. Some
format handlers return the compressed size and provide a decompression
transform stream while others return the decompressed stream directly
and put the decompressed size in "size".

As a way to simplify this, every format handler now returns a "size"
object with the following properties:

- `original`: The original compressed size
- `final.estimated`: Whether the final size is an estimation or not
- `final.value`: The final uncompressed size

As a bonus, we extract the file size retrieval logic to
`imageStream.getFromFilePath()`, which is the onlt part where the
concept of a file should be referred to.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-26 12:01:53 -04:00
Juan Cruz Viotti
0e1f50422e refactor: integrate etcher-image-stream into the etcher repository (#1040)
This is a long lasting task. The `etcher-image-stream` project takes
care of converting any kind of image input into a NodeJS readable
stream, handling things like decompression in betwee, however its a
module that, except for weird cases, there is no benefit on having
separate from the main repository.

In order to validate the assumption above, we've left the module
separate for almost a year, and no use case has emerged to keep it
like that.

This commit joins the code and tests of that module in the main
repository.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 10:32:37 -04:00
Juan Cruz Viotti
acc1f05269 refactor: move lib/shared/child-writer to lib/child-writer (#1041)
The `child-writer` module is not re-used by both the GUI and the CLI, so
it makes sense to have it in `lib/child-writer`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-24 12:06:34 -04:00
Juan Cruz Viotti
5b3926cf10 v1.0.0-beta.18 2017-01-16 11:02:11 -04:00
Juan Cruz Viotti
2b4b1da492 upgrade: drivelist to v5.0.6 (#1020)
- https://github.com/resin-io-modules/drivelist/issues/130

Change-Type: patch
Changelog-Entry: Fix "This key is already associated with an element of this collection" error when multiple partitions point to the same drive letter on Windows.
Fixes: https://github.com/resin-io/etcher/issues/1004
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-12 15:21:58 -04:00
Juan Cruz Viotti
c707c76633 feat(CLI): improve error messages (#1015)
- Inline dictionary of common error codes and friendly descriptions

We used to rely on `resin-cli-errors` for this, however the friendly
descriptions set there can be usually very Resin CLI specific, and thus
confusing to Etcher users.

The dictionary, along with other error related utilities live in
`lib/cli/errors.js`.

- Print error descriptions and codes if they are found

- Move `utils.printError()` to `errors.print()`

Change-Type: minor
Changelog-Entry: Improve Etcher CLI error messages.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-11 18:45:59 -04:00
Juan Cruz Viotti
971ef7d8f9 chore: make use of the "spec" mocha reporter (#1013)
The "min" mocha reporter clears the screen after each run, causing any
error/warning from the renderer process tests to be visually overwritten
by the main process tests.

Therefore, we now make use of the "spec" mocha reporter.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-10 21:36:17 -04:00
Juan Cruz Viotti
404eeffbeb chore: compile CSS into lib/gui/css (#1002)
We currently compile CSS into `build/css`, however we plan to use
node-gyp in this project, which can't be configured to build to a
directory other than `build`, therefore, the compiled CSS must move
somewhere else.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-06 15:55:07 -04:00
Ștefan Daniel Mihăilă
050d187e6f refactor: extract SelectionStateModel stateless functions (#982)
`SelectionStateModel`'s methods `isSystemDrive` and `isDriveLocked`
don't depend on application state. They have been extracted in a different
AngularJS service: `DriveConstraintsModel`. The new service's actual
implementation is in `lib/src`, in order to be reused by the CLI.

Miscellaneous changes:

- Rename `lib/src` to `lib/shared`
- Refactor `drive-constraints` to throw when image is undefined

The default behaviour was to pretend that we're all good if the if
the image is not specified. We're not using this "feature", and
it can be dangerous if we forget to pass in the image.

- Make `isSystemDrive` return `false` if `system` property is undefined
- Use `drive-constraints` in `store.js`

Change-Type: patch
2017-01-06 12:42:11 -04:00
Juan Cruz Viotti
dc32699b65 upgrade: drivelist to v5.0.5 (#1001)
- https://github.com/resin-io-modules/drivelist/pull/129

Change-Type: patch
Changelog-Entry: Fix system drives detected as removable drives on Mac Mini.
See: https://github.com/resin-io/etcher/issues/983
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-06 12:22:08 -04:00
Juan Cruz Viotti
e641265f4d upgrade: etcher-image-write to v9.0.0 (#1000)
This version includes support for retrying up to ten times when EIO
errors are encountered during reading.

See: https://github.com/resin-io-modules/etcher-image-write/pull/70
Fixes: https://github.com/resin-io/etcher/issues/981
Change-Type: patch
Changelog-Entry: Fix sporadic "EIO: i/o error, read" errors during validation.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-06 11:31:16 -04:00
Juan Cruz Viotti
e210a2ba0e upgrade: etcher-image-write to v8.1.5 (#998)
- https://github.com/resin-io-modules/etcher-image-write/pull/73

Fixes: https://github.com/resin-io/etcher/issues/834
Changelog-Entry: Fix "EIO: i/o error, write" error.
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-05 11:20:19 -04:00
Juan Cruz Viotti
8e7599b366 chore: implement electron-configure-package-win32.sh (#962)
This script configures an Electron package on Windows.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-13 11:04:09 -04:00
Juan Cruz Viotti
55bd372082 v1.0.0-beta.17
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-28 09:58:29 -04:00
Juan Cruz Viotti
6e0d8e1f5c refactor: ditch electron-osx-sign for OS X signing (#901)
Making use of `codesign` directly allows us to have much more
flexibility in how we sign things, which will prove very valuable when
adapting this `sign.sh` script to code sign the Etcher CLI.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-28 01:13:02 -04:00
Juan Cruz Viotti
3eac1762b1 upgrade: drivelist to v5.0.4 (#893)
- https://github.com/resin-io-modules/drivelist/pull/125

Change-Type: patch
Changelog-Entry: Fix drive scanning exceptions on GNU/Linux systems with `net.ifnames` enabled.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-25 12:56:44 -04:00
Juan Cruz Viotti
c4868995aa chore: add appdmg and ds-store to shrinkwrapIgnore (#895)
These dependencies are suddently causing issues when running `npm
install` in platforms other than OS X.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-25 12:08:29 -04:00
Juan Cruz Viotti
4296868ff7 upgrade: drivelist to v5.0.3 (#871)
See: https://github.com/resin-io-modules/drivelist/pull/120
Fixes: https://github.com/resin-io/etcher/issues/870
Change-Type: patch
Changelog-Entry: Fix `0x80131700` error when scanning drives on Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-16 14:29:34 +00:00
Juan Cruz Viotti
6456a8fe96 upgrade: drivelist to v5.0.1 (#869)
- Fix internal SDCard reader descriptions in GNU/Linux.
- Transform `mountpoint` into an array of mountpoints.

Change-Type: patch
Changelog-Entry: Fix internal SDCard drive descriptions.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-16 13:52:20 +00:00
Juan Cruz Viotti
4e3bdb7e22 refactor(CLI): move UNIX umount functionality to repository (#866)
- Move UNIX unmount functionality to the CLI module
- Run `electron-mocha` for the CLI code
- Make unmount command templates that take a `drivelist` object as input

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-14 11:11:49 +02:00
Juan Cruz Viotti
6e03a00008 upgrade: electron-mocha to v3.1.1 (#854)
The current version would exit with error code 0 even when the tests
failed, causing CI servers to report false positives.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-09 22:20:11 +02:00
Juan Cruz Viotti
0085880d3c chore: add productDescription to package.json (#842)
This key is added as the long description of the Debian package.
Omitting this option means that `description` is duplicated two times,
which is of course not the desired outcome.

See: https://github.com/resin-io/etcher/issues/632
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-09 17:04:05 +02:00
Juan Cruz Viotti
9c4afa0680 upgrade: umount to v1.1.5 (#843)
The changes we're interested in are:

- Escape device paths containing spaces.

Change-Type: patch
Changelog-Entry: Fix unmount issues in GNU/Linux and OS Xwhen paths contain spaces.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-07 18:07:57 +02:00
Juan Cruz Viotti
136d935eed upgrade: etcher-image-write to v8.1.4 (#831)
We're interested in the following change, which causes the last
unaligned block on an image to be aligned to 512K instead of to 1M if
its smaller than 512K, and to 1M otherwise.

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

Fixes: https://github.com/resin-io/etcher/issues/685
Change-Type: patch
Changelog-Entry: Fix "Not Enough Space" error when flashing unaligned images.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-07 17:02:23 +02:00
Juan Cruz Viotti
af0cfd9587 chore: update package.json and README.md to match repo description (#824)
Repository description says "Flash OS images to SD cards & USB drives,
safely and easily.", while `package.json` currently says "An image
flasher with support for Windows, OS X and GNU/Linux.", and `README.md`
contains "Flash OS images to SD cards & USB drives, safe & easy."

See: https://github.com/resin-io/etcher/issues/797
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-03 09:41:41 -04:00
Juan Cruz Viotti
adfa0fcd83 chore: remove removedrive from dependencies (#825)
This dependency is already being listed in `optionalDependencies`, which
the place it really belongs to.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-03 09:41:32 -04:00
Juan Cruz Viotti
428dbeaf55 upgrade: umount to v1.1.4 (#817)
- This new version passes `force` to `diskutil unmountDisk`

Change-Type: patch
Changelog-Entry: Fix `at least one volume could not be unmounted` error in OS X.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-02 00:04:36 -04:00
Juan Cruz Viotti
bc985f08a9 fix(GUI): duplicate drives in Windows (#790)
If a drive contains multiple partitions that Windows recognises and
mounts, then `drivelist` will incorrectly display separate drive objects
for each partition, causing `ngRepeat` to complain in the drive selector
component.

The issue was fixed by grouping the mountpoints of all recognised
partitions in a single drive object, as we do with the other supported
operating systems.

After the fix, `drivelist` also removed its `name` property (since its
now always equal to `device`), so some extra logic to compute an
appropriate display name for the drive has been introduced to
`DriveScannerService`.

Fixes: https://github.com/resin-io/etcher/issues/720
See: https://github.com/resin-io-modules/drivelist/pull/100
Change-Type: patch
Changelog-Entry: Fix duplicate drives in Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-31 01:18:58 -04:00
Juan Cruz Viotti
8103ba851f v1.0.0-beta.16
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-28 16:42:15 -04:00
Juan Cruz Viotti
d9822faf2f fix(GUI): emit progress back to parent using node-ipc (#774)
This PR makes use of `node-ipc` to emit progress information from the
child CLI to the GUI process rather than the tailing approach we've
been doing until now.

This change was motivated by the following Electron fix which landed in
v1.4.4: https://github.com/electron/electron/pull/7578. Before such fix,
Electron would not output anything to stdout/stderr if the Electron
process was running with `ELECTRON_RUN_AS_NODE` under Windows, which
forced us to implement `--log` option in the Etcher CLI to output state
information to a file.

Since this issue is fixed, we can consume the Etcher CLI output from
within `child_process.spawn`, which opens more interesting possibilities
for sharing information between both processes.

This coindentally fixes a Windows issue where the tailing module would
receive malformed JSON, causing Etcher to crash at `JSON.parse`. The
reason of this problem was a bug in the tailing module we were using.

Fixes: https://github.com/resin-io/etcher/issues/642
Change-Type: patch
Changelog-Entry: Fix "Unexpected end of JSON" error in Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-25 23:56:39 -04:00
Juan Cruz Viotti
c7f4313ded upgrade: etcher-image-stream to v5.1.0 (#752)
We're particularly interested in the following change:

- Add `etch` support.

Also:

- Add a `.description` property to all archive related errors.
- Rename archive metadata base path from `_info` to `.meta`.

Change-Type: minor
Changelog-Entry: Add support for `etch` images.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-07 15:32:25 -03:00
Juan Cruz Viotti
feb120bf8c v1.0.0-beta.15 2016-09-26 19:28:23 -04:00
Juan Cruz Viotti
95aaea5a0f upgrade: etcher-image-write to v8.1.3 (#719)
This version contains an important fix for the sporadic EPERM issues
encountered on Windows systems.

Fixes: https://github.com/resin-io/etcher/issues/627
Link: https://github.com/resin-io-modules/etcher-image-write/blob/master/CHANGELOG.md
Change-Type: patch
Changelog-Entry: Fix sporadic EPERM write errors on Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-25 21:50:54 -04:00
Juan Cruz Viotti
f9ce62d34f upgrade: etcher-image-write to v8.1.2 (#712)
This version contains a fix for incorrect validation errors being
reported when flashing bzip2 files due to incorrect slicing of the drive
stream when calculating the checksum.

See: https://github.com/resin-io-modules/etcher-image-write/pull/61
Change-Type: patch
Changelog-Entry: Fix incorrect validation errors when flashing bzip2 images.
Fixes: https://github.com/resin-io/etcher/issues/710
Fixes: https://github.com/resin-io/etcher/issues/709
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-22 13:17:10 -04:00
Juan Cruz Viotti
6d767231f8 upgrade: drivelist to v3.3.4 (#714)
This new version contains a fix for a very weird `cscript is not
recognised` error reported long ago.

Change-Type: patch
Changelog-Entry: Fix "cscript is not recognised as an internal or external command" Windows error.
Fixes: https://github.com/resin-io/etcher/issues/552
See: https://github.com/resin-io-modules/drivelist/pull/95
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-22 13:15:39 -04:00
Juan Cruz Viotti
7ea098c0d6 v1.0.0-beta.14
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-12 11:10:16 -07:00
Juan Cruz Viotti
a4e3fcccba upgrade: etcher-image-stream to v4.3.0 (#699)
This new version contains the following changes:

- Add `recommendedDriveSize` property in `_info/manifest.json`.
- Upgrade `unbzip2-stream` to v1.0.10, which fixes a known uncaught
  exception when decompressing large `.bz2` files.
- Add support for markdown instructions at
  `_info/instructions.markdown`.

Changelog-Entry: Upgrade `etcher-image-stream` to v4.3.0.
Change-Type: minor
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-12 10:55:13 -07:00
Juan Cruz Viotti
0ff0c77acc feat: zero out configured bytes from drive before flashing with bmap (#691)
This PR makes use of the `bytesToZeroOutFromTheBeginning` option
introduced in:

- https://github.com/resin-io-modules/etcher-image-stream/pull/34
- https://github.com/resin-io-modules/bmapflash/pull/6

The option, when set in `manifest.json`, causes a certain amount of
bytes to be zeroed out before the bmap-assisted write process starts, in
order to prevent issues on certain ROM bootloaders causing by
`bmap-tools` thinking certain parts of the initial sectors are holes.

The following components were upgraded:

- `etcher-image-stream` was upgraded to v4.1.0
- `etcher-image-write` was upgraded to v8.1.0

Changelog-Entry: Allow archive images to configure a certain amount of bytes to be zeroed out from the beginning of the drive when using bmaps.
Change-Type: minor
Fixes: https://github.com/resin-io/etcher/issues/673
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-07 13:36:08 -07:00
Juan Cruz Viotti
ce1c1d724d upgrade: etcher-image-write to v8.0.0 (#688)
This new version stops sending a `passedValidation` boolean property
upon completion and still throws an `EVALIDATION` error when validation
fails.

Such small chance allows us to get rid of lot of complexity related to
handling the `passedValidation` value in the application state.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-07 10:24:34 -07:00
Juan Cruz Viotti
b1ba1c887f upgrade: etcher-image-stream to v4.0.0 (#682)
We're interested in the following changes:

- Add `supportUrl` property in `_info/manifest.json`.
- Add `releaseNotesUrl` property in `_info/manifest.json`.
- Add `version` property in `_info/manifest.json`.
- Add `checksum` and `checksumType` properties in `_info/manifest.json`.

Link: https://github.com/resin-io-modules/etcher-image-stream/blob/master/CHANGELOG.md
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 15:44:39 -04:00
Juan Cruz Viotti
f63cad3696 upgrade: drivelist to v3.3.3 (#681)
- https://github.com/resin-io-modules/drivelist/pull/94

Change-Type: patch
Changelog-Entry: Show device id if device doesn't have an assigned drive letter in Windows.
Fixes: https://github.com/resin-io/etcher/issues/671
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 13:52:31 -04:00
Juan Cruz Viotti
47c50ffe14 chore(GUI): integrate scss-lint (#666)
This PR integrates SCSS Lint, a tool that will help us keep SCSS tidier.
I've included a sensible configuration at `.scss-lint.yml`, and
documentation on how to install it on `CONTRIBUTING.md`.

The tool will run automatically as part of `npm run lint`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-26 15:09:07 -04:00
Juan Cruz Viotti
3c5eff3739 upgrade: drivelist to v3.3.1 (#659)
This version contains a fix for the `blkid: command not found` error in
certain GNU/Linux distributions.

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

Change-Type: patch
Changelog-Entry: Fix `blkid: command not found` error in certain GNU/Linux distributions.
Fixes: https://github.com/resin-io/etcher/issues/640
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-26 10:26:30 -04:00
Juan Cruz Viotti
e91ec71b29 upgrade: etcher-image-stream to v3.1.2 (#658)
- https://github.com/resin-io-modules/etcher-image-stream/pull/27

Change-Type: patch
Changelog-Entry: Fix incorrect estimated entry sizes in certain ZIP archives.
Fixes: https://github.com/resin-io/etcher/issues/644
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-24 11:30:57 -04:00
Juan Cruz Viotti
893f42a124 upgrade: etcher-image-write to v7.0.1 (#657)
- https://github.com/resin-io-modules/etcher-image-write/pull/53

Change-Type: patch
Changelog-Entry: Prevent `ENOSPC` if the drive capacity is equal to the image size.
Fixes: https://github.com/resin-io/etcher/issues/629
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-24 11:03:30 -04:00