Skip to content

Commit

Permalink
Fix sandbox error on AppImage startup on certain linux systems (#4458)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jun 19, 2024
1 parent 46620f5 commit 611cecb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
25 changes: 25 additions & 0 deletions products/jbrowse-desktop/linux-sandbox-fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// from https://github.com/d3473r/jitsi-meet-electron/commit/11b9348f117a87349917c252cbae203cf92062a
//
const fs = require('fs').promises
const path = require('path')

/**
* Workaround for https://github.com/electron-userland/electron-builder/issues/5371
*
* use as "afterPack": "./linux-sandbox-fix.js" in build section of package.json
*/
async function afterPack({ appOutDir, electronPlatformName, packager }) {
if (electronPlatformName !== 'linux') {
return
}

const appName = packager.appInfo.productFilename
const script = `#!/bin/bash\n"\${BASH_SOURCE%/*}"/${appName}.bin --no-sandbox "$@"`
const scriptPath = path.join(appOutDir, appName)

await fs.rename(scriptPath, `${scriptPath}.bin`)
await fs.writeFile(scriptPath, script)
await fs.chmod(scriptPath, 0o755)
}

module.exports = afterPack
5 changes: 3 additions & 2 deletions products/jbrowse-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"repository": "https://github.com/GMOD/jbrowse-components.git",
"scripts": {
"start": "cross-env BROWSER=none node scripts/start.js",
"electron": "electron .",
"electron": "electron . --no-sandbox",
"electron-ts": "tsc --strict --esModuleInterop --skipLibCheck public/electron.ts",
"preelectron": "npm run electron-ts",
"prebuild": "npm run electron-ts",
Expand Down Expand Up @@ -180,7 +180,8 @@
"directories": {
"buildResources": "assets/"
},
"afterSign": "scripts/notarize.js"
"afterSign": "scripts/notarize.js",
"afterPack": "./linux-sandbox-fix.js"
},
"private": true
}

0 comments on commit 611cecb

Please sign in to comment.