From d8cb8f78154910f46b70f4b2537d57169b1a0b60 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Wed, 19 Feb 2020 16:11:17 +0000 Subject: [PATCH 1/2] fix(afterPack): error on launch from deb terminal When installing balena-etcher via apt on Debian/Ubuntu, the command `balena-etcher-electron` fails with the error: line 3: /usr/bin/balena-etcher-electron.bin: No such file or directory This is because the /usr/bin/balena-etcher-electron is a symlink to /opt/balenaEtcher/balena-etcher-electron, but the script looks for balena-etcher-electron.bin in the symlink directory, not the actual script location directory. This commit uses `$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")` to find the real location of the balena-etcher-electron script without symlink, so that balena-etcher-electron.bin is correctly found. Change-Type: patch Changelog-Entry: Fix error when launching from terminal when installed via apt. Fixes: https://github.com/balena-io/etcher/issues/3074 --- afterPack.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/afterPack.js b/afterPack.js index d71613e2..eb192ee9 100644 --- a/afterPack.js +++ b/afterPack.js @@ -14,12 +14,16 @@ exports.default = function(context) { cp.execFileSync('mv', [scriptPath, binPath]) fs.writeFileSync( scriptPath, - outdent` + outdent({trimTrailingNewline: false})` #!/bin/bash + + # Resolve symlinks. Warning, readlink -f doesn't work on MacOS/BSD + script_dir="$(dirname "$(readlink -f "\${BASH_SOURCE[0]}")")" + if [[ $EUID -ne 0 ]] || [[ $ELECTRON_RUN_AS_NODE ]]; then - "\${BASH_SOURCE%/*}"/${context.packager.executableName}.bin "$@" + "\${script_dir}"/${context.packager.executableName}.bin "$@" else - "\${BASH_SOURCE%/*}"/${context.packager.executableName}.bin "$@" --no-sandbox + "\${script_dir}"/${context.packager.executableName}.bin "$@" --no-sandbox fi ` ) From 0b20a1eeaa0ef02a0df65d90e66ba5a6f794edf6 Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Thu, 20 Feb 2020 14:20:58 +0100 Subject: [PATCH 2/2] Remove "Download the React DevTools for a better development experience" message Changelog-entry: Remove "Download the React DevTools for a better development experience" message Change-type: patch --- webpack.config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webpack.config.ts b/webpack.config.ts index ccdc32e4..5b179a48 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -17,6 +17,7 @@ import * as _ from 'lodash'; import * as path from 'path'; import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin'; +import { BannerPlugin } from 'webpack'; import * as nodeExternals from 'webpack-node-externals'; /** @@ -84,6 +85,14 @@ const guiConfig = { gui: path.join(__dirname, 'lib', 'gui', 'app', 'app.ts'), }, devtool: 'source-map', + plugins: [ + ...commonConfig.plugins, + // Remove "Download the React DevTools for a better development experience" message + new BannerPlugin({ + banner: '__REACT_DEVTOOLS_GLOBAL_HOOK__ = { isDisabled: true };', + raw: true, + }), + ], }; const etcherConfig = {