mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-18 16:56:32 +00:00
Wrapper script for linux to add --no-sandbox when running as root
Change-type: patch
This commit is contained in:
parent
5b22fcc2f5
commit
2f828b1d39
@ -17,6 +17,7 @@
|
|||||||
"copyright": "Copyright 2016-2019 Balena Ltd",
|
"copyright": "Copyright 2016-2019 Balena Ltd",
|
||||||
"productName": "balenaEtcher",
|
"productName": "balenaEtcher",
|
||||||
"nodeGypRebuild": true,
|
"nodeGypRebuild": true,
|
||||||
|
"afterPack": "./afterPack.js",
|
||||||
"files": [
|
"files": [
|
||||||
"generated",
|
"generated",
|
||||||
"lib/shared/catalina-sudo/sudo-askpass.osascript.js",
|
"lib/shared/catalina-sudo/sudo-askpass.osascript.js",
|
||||||
|
27
afterPack.js
Normal file
27
afterPack.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
const cp = require('child_process')
|
||||||
|
const fs = require('fs')
|
||||||
|
const outdent = require('outdent')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
exports.default = function(context) {
|
||||||
|
if (context.packager.platform.name !== 'linux') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const scriptPath = path.join(context.appOutDir, context.packager.executableName)
|
||||||
|
const binPath = scriptPath + '.bin'
|
||||||
|
cp.execFileSync('mv', [scriptPath, binPath])
|
||||||
|
fs.writeFileSync(
|
||||||
|
scriptPath,
|
||||||
|
outdent`
|
||||||
|
#!/bin/bash
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
"\${BASH_SOURCE%/*}"/${context.packager.executableName}.bin "$@"
|
||||||
|
else
|
||||||
|
"\${BASH_SOURCE%/*}"/${context.packager.executableName}.bin "$@" --no-sandbox
|
||||||
|
fi
|
||||||
|
`
|
||||||
|
)
|
||||||
|
cp.execFileSync('chmod', ['+x', scriptPath])
|
||||||
|
}
|
@ -4,6 +4,7 @@ productName: balenaEtcher
|
|||||||
npmRebuild: true
|
npmRebuild: true
|
||||||
nodeGypRebuild: true
|
nodeGypRebuild: true
|
||||||
publish: null
|
publish: null
|
||||||
|
afterPack: "./afterPack.js"
|
||||||
files:
|
files:
|
||||||
- generated
|
- generated
|
||||||
- lib/shared/catalina-sudo/sudo-askpass.osascript.js
|
- lib/shared/catalina-sudo/sudo-askpass.osascript.js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user