qortal-ui/scripts/afterPack.js

39 lines
873 B
JavaScript
Raw Permalink Normal View History

2021-12-25 14:39:47 +01:00
const path = require('path')
const shell = require("shelljs")
2021-12-25 14:39:47 +01:00
const runShellCommand = (appOutDir) => {
shell.exec(
`chmod 4755 ${path.join(appOutDir, "chrome-sandbox")}`,
function (code, stdout, stderr) {
console.log('runShellCommand ==> Exit code:', code)
if (stderr) {
console.log('runShellCommand ==> Program stderr:', stderr)
}
}
)
2021-12-25 14:39:47 +01:00
}
async function doLinux(context) {
console.log("Running doLinux ==> ")
2021-12-25 14:39:47 +01:00
const { targets, appOutDir } = context
2021-12-25 14:39:47 +01:00
targets.forEach(async target => {
if (!["appimage", "snap"].includes(target.name.toLowerCase())) {
await runShellCommand(appOutDir)
}
})
2021-12-25 14:39:47 +01:00
}
async function afterPack(context) {
console.log("Running AfterPack")
2021-12-25 14:39:47 +01:00
const electronPlatformName = context.electronPlatformName.toLowerCase()
2021-12-25 14:39:47 +01:00
if (electronPlatformName.includes("linux")) {
await doLinux(context)
}
2021-12-25 14:39:47 +01:00
}
module.exports = afterPack