Skip to content

Commit

Permalink
Add no-sandbox wrapper, fixes #1156
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Apr 1, 2020
1 parent 0ee7526 commit 910c57e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions afterPack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const fs = require("fs-extra");
const path = require("path");

module.exports = async function(context) {
const distDir = context.appOutDir;
var wrapperScript;

if (context.targets.find(target => target.name === "deb")) {
wrapperScript = `#!/bin/bash
/opt/ubports-installer/ubports-installer.bin --no-sandbox "$@"
`;
} else if (context.targets.find(target => target.name === "appImage")) {
wrapperScript = `#!/bin/bash
"\${BASH_SOURCE%/*}"/ubports-installer.bin --no-sandbox "$@"
`;
} else {
console.log("no wrapper needed");
return;
}

fs.moveSync(
path.join(distDir, "ubports-installer"),
path.join(distDir, "ubports-installer.bin")
);
fs.writeFileSync(path.join(distDir, "ubports-installer"), wrapperScript);
fs.chmodSync(path.join(distDir, "ubports-installer"), 0o765);
};
3 changes: 2 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ switch (cli.os) {
"android-tools-adb",
"android-tools-fastboot"
]
}
},
afterPack: "./afterPack.js"
});
break;
case "win":
Expand Down

0 comments on commit 910c57e

Please sign in to comment.