mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-15 13:18:40 -09:00
Use hack
This commit is contained in:
parent
e10f637999
commit
b9e3d1ca15
1 changed files with 31 additions and 0 deletions
31
bin/cp-snapshot.js
vendored
31
bin/cp-snapshot.js
vendored
|
|
@ -42,6 +42,7 @@ exports.default = async (context) => {
|
||||||
? `${context.appOutDir}/Hyper.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources`
|
? `${context.appOutDir}/Hyper.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources`
|
||||||
: context.appOutDir;
|
: context.appOutDir;
|
||||||
copySnapshot(pathToElectron, archToCopy);
|
copySnapshot(pathToElectron, archToCopy);
|
||||||
|
useLoaderScriptFix(context);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
|
|
@ -51,3 +52,33 @@ if (require.main === module) {
|
||||||
copySnapshot(pathToElectron, archToCopy);
|
copySnapshot(pathToElectron, archToCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copied and modified from https://github.com/gergof/electron-builder-sandbox-fix/blob/master/lib/index.js
|
||||||
|
// copied and modified from https://github.com/Adamant-im/adamant-im/blob/7b20272a717833ffb0b49b034ab9974118fc59ec/scripts/electron/sandboxFix.js
|
||||||
|
|
||||||
|
const useLoaderScriptFix = async (params) => {
|
||||||
|
if (params.electronPlatformName !== 'linux') {
|
||||||
|
// this fix is only required on linux
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const executable = path.join(params.appOutDir, params.packager.executableName)
|
||||||
|
|
||||||
|
const loaderScript = `#!/usr/bin/env bash
|
||||||
|
set -u
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
exec "$SCRIPT_DIR/${params.packager.executableName}.bin" "--no-sandbox" "$@"
|
||||||
|
`
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fs.rename(executable, executable + '.bin')
|
||||||
|
await fs.writeFile(executable, loaderScript)
|
||||||
|
await fs.chmod(executable, 0o755)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('failed to create loader for sandbox fix: ' + e.message, chalk.red)
|
||||||
|
throw new Error('Failed to create loader for sandbox fix')
|
||||||
|
}
|
||||||
|
|
||||||
|
log('sandbox fix successfully applied', chalk.green)
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue