Merge pull request #2688 from balena-io/fix-appimage

Use APPDIR from env in the child writer
This commit is contained in:
Alexis Svinartchouk 2019-03-12 16:29:00 +01:00 committed by GitHub
commit 00c94c8efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,7 +206,7 @@ exports.performWrite = (image, drives, onProgress) => {
})
const argv = _.attempt(() => {
const entryPoint = getApplicationEntryPoint()
let entryPoint = getApplicationEntryPoint()
// AppImages run over FUSE, so the files inside the mount point
// can only be accessed by the user that mounted the AppImage.
@ -214,18 +214,13 @@ exports.performWrite = (image, drives, onProgress) => {
// mount-point, and as a workaround, we re-mount the original
// AppImage as root.
if (os.platform() === 'linux' && process.env.APPIMAGE && process.env.APPDIR) {
entryPoint = _.replace(entryPoint, process.env.APPDIR, '')
return [
process.env.APPIMAGE,
// Executing the AppImage with ELECTRON_RUN_AS_NODE opens
// the Node.js REPL without loading the default entry point.
// As a workaround, we can pass the path to the file we want
// to load, relative to the usr/ directory of the mounted
// AppImage.
_.replace(entryPoint, path.join(process.env.APPDIR, 'usr/'), '')
'-e',
`require(\`\${process.env.APPDIR}${entryPoint}\`)`
]
}
return [
_.first(process.argv),
entryPoint