mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 15:27:17 +00:00
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
This commit is contained in:
parent
36f79593cf
commit
d8cb8f7815
10
afterPack.js
10
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
|
||||
`
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user