243 Commits

Author SHA1 Message Date
Juan Cruz Viotti
2f980e808f chore: add x86 architecture support for darwin/dependencies.sh (#883)
We don't really do x64 builds for OS X at the moment, but nice to make
the build scripts consistent.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-18 17:28:23 +00:00
Juan Cruz Viotti
8d44c9b86c refactor: extract OS X build script into many files (#875)
This is the first step towards decoupling the build system as many
different scripts, for maintainability and convenience purposes.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-18 16:54:14 +00:00
Juan Cruz Viotti
5ac486d941 style: refer to Resin.io as resin.io, according to the style manual (#823)
> For all, lower-case capitalization unless beginning a sentence (Ex. I
> like resin.io. Resin.io is great.)

See: https://github.com/resin-io/docs#style-manual
See: https://github.com/resin-io/etcher/issues/797
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-03 10:57:29 -04:00
Juan Cruz Viotti
8b47c3f017 chore: add bintray debian publishing script (#819)
This script can be used to publish Etcher debian packages to Bintray.

See: https://github.com/resin-io/etcher/issues/632
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-02 18:24:28 -04:00
Juan Cruz Viotti
45dac58e2a chore: remove www from etcher homepage URL (#808)
See: https://github.com/resin-io/etcher/pull/795
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-31 17:39:11 -04:00
Andrew Scheller
438c098953 chore: fix linux x86 build script (#780)
While the previous fix in #777 fixed repeated builds, it accidentally broke the first build!
2016-10-27 14:49:14 -04:00
Wasabi Fan
b6817cfbb3 chore: include Etcher version in installer/archive names 2016-10-27 10:46:04 -04:00
Andrew Scheller
0bbcc10cfe chore: fix minor install script problems (#777)
When running the install script as root (e.g. inside a Docker container), bower complained that it

"shouldn't" be run with sudo. When running the x86 install multiple times, it tried to move

Etcher-linux-ia32 inside the existing Etcher-linux-x86/ folder, rather than renaming it, which meant

later commands failed.
2016-10-26 14:58:47 -04:00
Juan Cruz Viotti
9618291f80 feat(GUI): spawn CLI directly from the AppImage in GNU/Linux (#775)
If we pass relative paths as arguments to the AppImage, they get
resolved from `/tmp/.mount_XXXXXX/usr`. We can exploit this to run the
Etcher CLI directly from the AppImage, rather than having to mount it
ourselves:

```sh
ELECTRON_RUN_AS_NODE=1 Etcher-linux-x64.AppImage bin/resources/app.asar [OPTIONS]
```

By using this little trick, we get rid of both our custom mounting logic
and the need of surrounding the command to run in single quotes,
therefore avoiding a whole new kind of escaping issues.

Since running the CLI directly from the AppImage means that the
`desktopintegration` will be ran for the CLI, we pass the `SKIP`
environment variable to avoid having it prompt the user for
installation.

We also updated the `desktopintegration` script to the latest version,
which reduces the amount of logging plus other minor fixes.

Fixes: https://github.com/resin-io/etcher/issues/637
Change-Type: patch
Changelog-Entry: Fix Etcher leaving zombie processes behind in GNU/Linux.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-26 14:07:17 -04:00
Juan Cruz Viotti
4d3eab4915 chore: create standalone Windows builds (#769)
This PR zips the package that is built by running:

```sh
.\scripts\build\windows.bat package <arch>
```

And puts it in `etcher-release/installers`.

Fixes: https://github.com/resin-io/etcher/issues/760
Change-Type: minor
Changelog-Entry: Publish standalone Windows builds.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-25 12:35:21 -04:00
Juan Cruz Viotti
63948874d7 chore: distribute AppImage inside a zip (#772)
AppImages need to be marked as executables before they can be used.
Distributing them directly means that virtually all web browsers will
automatically remove the execution permissions, leading us to have to
explain users how to add it back with `chmod`, etc.

For simplicity purposes, we'll be distributing AppImages inside ZIPs,
which ensure the execution permissions are added back when the user
decompresses it.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-24 20:25:16 -04:00
Juan Cruz Viotti
b6314bf397 refactor: use local variables in shell functions in build scripts (#771)
We translate function arguments (e.g: `$1`, `$2`, etc) to readable names
using shell variables in the top of every shell function in the build
scripts.

Since we were not declaring these variables as `local`, two functions
using the same "argument name" would override each other.

For example:

```sh
function foo() {
  variable=$1
  # Do something with $variable
}

function bar() {
  variable=$1
  # Do something with $variable
}

foo "Hello World"
echo $variable
> Hello World

bar "Changed variable"
echo $variable
> Changed variable
```

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-24 17:24:32 -04:00
Juan Cruz Viotti
d7d9dc099f chore: fix output_package unbound variable in GNU/Linux (#767)
The `$output_package` variable is defined inside the `package_x$ARCH`
functions, which means that if we run the following commands:

```sh
./scripts/build/linux.sh package x64
./scripts/build/linux.sh appimage x64
```

The `$output_package` variable will not be defined when the script runs
the `appimage` command.

To workaround this issue, we declare a new `$package_directory` variable
inside the `appimage` command clause.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-24 14:25:37 -04:00
David Lechner
c43dffce80 chore(debian): add dependency on polkit package (#758)
A policy kit authentication agent is needed for privilege escalation.

See: https://github.com/resin-io/etcher/issues/756#issuecomment-253298322
2016-10-14 12:09:02 -03:00
David Lechner
f28b5a859b chore: add debian packaging (#747)
This adds a "debian" command to the linux build script. It uses
electron-installer-debian to create a debian package.
2016-10-05 12:30:06 -04:00
David Lechner
aea9d30271 chore: only apply upx compression when packaging as appimage
Debian packaging tools cannot analyze the binaries if they are compressed
with upx. If we move the compression to the appimage command, then the
output of the package command can be used for building debian packages.
2016-10-02 21:17:28 -04:00
David Lechner
6fedc9eb83 chore: add appimage command to GNU/Linux build script
With this addition, the `package` command simply creates a standalone package, while "appimage" is the one that creates the actual AppImage. The "all" command still generates the AppImage as before.
2016-09-30 10:09:47 -04:00
Juan Cruz Viotti
66a810e764 chore: apply HFS+ compression to *.app in OS X (#715)
This results in ~10MB savings, which is not much, but still worth
reducing as much as we can.

See: https://github.com/resin-io/etcher/issues/711
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-23 14:11:42 -04:00
Juan Cruz Viotti
82cb7ab689 upgrade: removedrive to v1.0.0 (#611)
This version contains the following improvements:

- https://github.com/jviotti/removedrive/pull/3
- https://github.com/jviotti/removedrive/pull/2

We also make sure error descriptions are passed to the dialog service
since this module now sets that property in its error objects.

Change-Type: patch
Changelog-Entry: Upgrade `removedrive` to v1.0.0.
Link: https://github.com/jviotti/removedrive/blob/master/CHANGELOG.md
See: https://github.com/resin-io/etcher/issues/573
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-07-28 15:53:47 -04:00
Juan Cruz Viotti
ef96ae86a0 chore: stop requiring a specific nodejs version to build Etcher (#584)
We were previously requiring users to run the exact same NodeJS version as
Electron bundled in order to avoid native add-on compilation incompatibilities,
however this problem is completely mitigated by configuring NPM to build
against an Electron specific V8.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-07-19 22:28:41 -04:00
Juan Cruz Viotti
6348d88c95 chore: add commands to build scripts (#566)
Currently build scripts install dependencies and package everything on
every run. In order to allow more customisation, the build scripts now
accept the following commands:

- `install`: Only install dependencies.
- `package`: Only package the application.
- `all`: Install dependencies and package the application.

The above differentiation allows us to improve the documentation and CI
configuration files to point to the `install` commands instead of having
to explain how to configure NPM correctly, since that's done by the
build scripts by default.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-07-12 10:15:21 -04:00
Juan Cruz Viotti
4f49c4c9d0 fix(GUI): preserve original working directory in dialogs in GNU/Linux (#565)
The `$OWD` environment variable, which stands for "Original Working
Directory" is set in recent AppImageKit versions and equals the
directory from where the AppImage was run.

We set the open dialog default path to this environment variable for
consistency with other GNU/Linux applications.

Change-Type: patch,
Changelog-Entry: Set dialog default directory to the place where the AppImage was run from in GNU/Linux.
See: 1569d6f854
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-07-11 13:36:40 -04:00
Juan Cruz Viotti
ea1df5cc11 chore: make use of ESLint (#540)
JSCS has merged with ESLint. This is the perfect excuse to move to
ESLint and unify both JSHint and JSCS hints under ESLint.

This PR also deprecates `gulp lint` in favour of `npm run lint`.

See: https://medium.com/@markelog/jscs-end-of-the-line-bc9bf0b3fdb2#.zbuwvxa5y
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-30 20:09:44 +05:30
Juan Cruz Viotti
b02620c835 refactor: group AppImage related stuff (#498)
Currently we had AppImage scripts and other resources in various
different places in the code base.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-22 10:40:04 -04:00
Juan Cruz Viotti
588c510778 chore(shrinkwrap): omit platform-specific deps (#503)
If you run an `npm install` and then run `npm shrinkwrap`, the resulting
shrinkwrap file will contain the installed optional dependencies, making
them "required". If such optional dependency is platform dependent, `npm
install` will fail on different platform.

This is a known `shrinkwrap` limitation whose only workaround seems to
be manually filtering out platform specific dependencies from
`npm-shrinkwrap.json`.

For this purpose, we introduced the following changes:

- A custom `shrinkwrapIgnore` property in `package.json`, where we can
list specific modules that need to be filtered out from
`npm-shrinkwrap.json`.

- A NodeJS script to generate `npm-shrinkwrap.json` and omit modules
specified in `shrinkwrapIgnore` automatically.

- An NPM script called `shrinkwrap`, for convenience.

- Add `macos-alias` and `fs-xattr` to `shrinkwrapIgnore`.

- Regenerate `npm-shrinkwrap.json` based on newer dependencies from PRs
created before we introduced `npm-shrinkwrap.json` but merged after that
file was in place.

See: https://github.com/npm/npm/issues/2679
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-21 15:21:08 -04:00
Juan Cruz Viotti
95deab0b0d Get rid of application-wide elevation (#423)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-20 21:49:16 -04:00
Juan Cruz Viotti
f49e2982e5 Resolve AppImage binary path correctly when running it as root (#490)
Currently, when the AppImage was being ran as `root` we would attempt to
run `./usr/bin/etcher`, assuming we were inside the AppDir already and
the relative path would resolve correctly.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-17 15:12:15 -04:00
Juan Cruz Viotti
9895773b6c Make sure elevated mount-point evaluates to a single line in GNU/Linux (#488)
Consider the case where a previously elevated mount was not unmounted
correctly. `mount | grep $(basename $APPIMAGE)` would evaluate to a
multi-line string, and therefore `awk` will perform its work on *each*
line separately, usually returning something like:

```
/tmp/.mountXXXX
/tmp/.mountYYYY-elevated
```

We then pass `$mountpoint` to `mkdir -p`, which evaluates to:

```
mkdir -p /tmp/.mountXXXX
/tmp/.mountYYYY-elevated
```

Therefore `/tmp/.mountXXXX` gets created, and
`/tmp/.mountYYYY-elevated` is ran as an executable, causing all sort of
cryptic errors to come out. This can be even worse, since the third
column of a `mount` line is not always a path, so the errors make even
less sense.

Fixes: https://github.com/resin-io/etcher/issues/482
Fixes: https://github.com/resin-io/etcher/issues/459

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-16 10:18:21 -04:00
Juan Cruz Viotti
52f47d7b61 Check for python in build scripts (#485)
This dependency is not used directly by our build scripts, but its used
by `node-gyp` when building native modules, and its much nicer to show a
warning early on than having to halt the build script in the middle for
missing this dependency (specially on Windows systems).

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-15 11:26:22 -04:00
Juan Cruz Viotti
bedda41843 Provide a GUI elevation dialog for GNU/Linux (#440)
Fixes: https://github.com/resin-io/etcher/issues/439
Fixes: https://github.com/resin-io/etcher/issues/412
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-26 10:04:23 -04:00
Juan Cruz Viotti
e9164df384 Install NPM dev dependencies during the build (#437)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-24 15:35:56 -04:00
Juan Cruz Viotti
f4d9de850c Fix indentation in build scripts (#428)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-23 14:27:03 -04:00
Juan Cruz Viotti
94e209ac80 Install dev dependencies before calling electron-builder on Windows (#426)
Since the addition of a patch to only install production dependencies on
build scripts, the Windows build would fail when reaching to
`electron-builder`, since this dependency might not be installed at that
point.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-22 22:45:06 -04:00
Juan Cruz Viotti
9c755fbb53 Override files if needed in the build scripts (#425)
This allows the users to continuously run the build script without
having to remove `etcher-release` or certain files inside that directory
to prevent silly "file exists" errors.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-22 22:44:59 -04:00
Juan Cruz Viotti
78fc028ae0 Only install production dependencies from build scripts (#424)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-22 21:43:27 -04:00
Juan Cruz Viotti
b061c116da Enforce expected NodeJS version in build scripts (#422)
Not building Etcher with the exact NodeJS version bundled with Electron
can cause all sorts of weird issues. This was previously documented, but
its now enforced so Etcher packagers don't forget by accident.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-20 10:51:09 -04:00
Juan Cruz Viotti
35f42665d2 Call packageignore.js after depencies have been installed in Windows (#409)
Otherwise, dependencies used by `packageignore.js`, like Lodash, could
not be found.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-13 17:54:43 -04:00
Juan Cruz Viotti
d36509d995 Implement cross-platform build scripts (#395)
With the addition of native addons to Etcher, its no longer possible to
package the application for all operating system in a single host.

Given we need to build on Windows, we're creating cross-platform bash
and batch scripts and deprecating the original Makefile.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-10 16:07:18 -04:00
Juan Cruz Viotti
f8b66b317a Escape leading periods on packageignore list (#373)
Otherwise, the `.` is interpreted as a period in a regular expression,
  which matches every literal character, causing some packages deep in
  the `node_modules/` hierarchy to be ignored for no reason.

For example, if we ignore `.git`, then a package like `foo-git` will be
excluded from the final package.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-27 14:24:55 -04:00
Juan Cruz Viotti
a462ee86c0 Add Makefile rule to generate an x86 AppImage for GNU/Linux (#349)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-21 09:01:34 -04:00
Juan Cruz Viotti
f683b841fa Make use of AppImage desktop integration script (#346)
This is useful to prompt the user to install the `.desktop` file.

The `Description` key in `Etcher.desktop` was changed to `Comment` since
`desktop-file-validate` complained with:

    Etcher.desktop: error: file contains key "Description" in group "Desktop
    Entry", but keys extending the format should start with "X-"

After checking the desktop file format specification, the correct key
should be "Comment"
(https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s05.html).

See: bc6e519964 (commitcomment-17164442)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-19 16:29:16 -04:00
Juan Cruz Viotti
bc6e519964 Generate AppImage package for GNU/Linux x86_64 (#345)
Fixes: https://github.com/resin-io/etcher/issues/323
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-19 13:29:32 -04:00
Juan Cruz Viotti
2b1ef3d980 Move package ignore list computation to a separate script (#285)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-11 12:30:00 -04:00