aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Settgast <csett86@web.de>2021-03-28 12:34:08 +0200
committerSaúl Ibarra Corretgé <s@saghul.net>2021-03-31 00:23:20 +0200
commit4cc851dc75ec15fdb054aa46e4132d8fbfa3a9e5 (patch)
treec9e46dd5ca38dd21c32131e7b4e60bccddba555c
parentf0957f73f68f7e7fc9eb1e1633cfd1082e316d35 (diff)
Linux: Fix running AppImage on Debian 10+ (#231)
Modeled after https://github.com/electron-userland/electron-builder/issues/5371#issuecomment-791771150 but written with promised-based fs nodejs API. This allows to drop the app-builder-lib .desktop patch, as --no-sandbox is now part of all linux targets via the additional launcher script, so the arg can be dropped from the .desktop file Exec line. Manual workaround is removed from the README as well.
-rw-r--r--README.md4
-rw-r--r--linux-sandbox-fix.js23
-rw-r--r--package.json1
-rw-r--r--patches/app-builder-lib+22.10.5.patch13
4 files changed, 24 insertions, 17 deletions
diff --git a/README.md b/README.md
index 8fb246c..f70cc48 100644
--- a/README.md
+++ b/README.md
@@ -150,12 +150,8 @@ Builtin auto-updates are not yet handled in macOS due to unsigned build.
### GNU/Linux
-There is a known issue which prevents the app from starting on some Linux distributions: [#231](https://github.com/jitsi/jitsi-meet-electron/issues/231)
-
If after downloading it, you can't execute the file directly, try running `chmod u+x ./jitsi-meet-x86_64.AppImage`
-The workaround for now is to launch the app like so: `./jitsi-meet-x86_64.AppImage --no-sandbox`
-
<details><summary>NOTE for old GNU/Linux distributions</summary>
You might get the following error:
diff --git a/linux-sandbox-fix.js b/linux-sandbox-fix.js
new file mode 100644
index 0000000..53c2506
--- /dev/null
+++ b/linux-sandbox-fix.js
@@ -0,0 +1,23 @@
+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;
diff --git a/package.json b/package.json
index 7a1d587..cd0e08b 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"appId": "org.jitsi.jitsi-meet",
"productName": "Jitsi Meet",
"generateUpdatesFilesForAllChannels": true,
+ "afterPack": "./linux-sandbox-fix.js",
"files": [
"**/*",
"resources",
diff --git a/patches/app-builder-lib+22.10.5.patch b/patches/app-builder-lib+22.10.5.patch
deleted file mode 100644
index adc0eab..0000000
--- a/patches/app-builder-lib+22.10.5.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
-index 0e56a1c..91180fc 100644
---- a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
-+++ b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
-@@ -134,7 +134,7 @@ class LinuxTargetHelper {
- exec += executableArgs.join(" ");
- }
-
-- exec += " %U";
-+ exec += " --no-sandbox %U";
- }
-
- const desktopMeta = {