Skip to content

Commit 0d1f405

Browse files
committed
fix linux permissions
Signed-off-by: Adam Setch <[email protected]>
1 parent c4a5acd commit 0d1f405

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ jobs:
6464
with:
6565
node-version-file: '.nvmrc'
6666
cache: 'pnpm'
67-
- run: sudo sysctl kernel.unprivileged_userns_clone=1 # See https://github.com/electron/electron/issues/17972#issuecomment-486927073
6867
- run: pnpm install
6968
- run: pnpm build
7069
- run: pnpm prepare:remove-source-maps

.github/workflows/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jobs:
7777
with:
7878
node-version-file: '.nvmrc'
7979
cache: 'pnpm'
80-
- run: sudo sysctl kernel.unprivileged_userns_clone=1 # See https://github.com/electron/electron/issues/17972#issuecomment-486927073
8180
- run: pnpm install
8281
- run: pnpm build
8382
env:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"repo": "gitify"
130130
},
131131
"afterSign": "scripts/notarize.js",
132-
"afterPack": "scripts/remove-unused-locales.js"
132+
"afterPack": "scripts/after-pack.js"
133133
},
134134
"dependencies": {
135135
"@electron/remote": "2.1.2",
Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,24 @@ const electronLanguages = packageJson.build.electronLanguages;
88
/**
99
* @param {AfterPackContext} context
1010
*/
11-
const removeLocales = async (context) => {
11+
const afterPack = async (context) => {
1212
const appName = context.packager.appInfo.productFilename;
1313
const appOutDir = context.appOutDir;
1414
const platform = context.electronPlatformName;
1515

16-
if (platform !== 'darwin') {
17-
return;
16+
if (platform === 'darwin') {
17+
removeUnusedLocales(appOutDir, appName);
18+
} else if (platform === 'linux') {
19+
fixChromeSandboxPermissions(appOutDir);
1820
}
21+
};
1922

23+
/**
24+
* Removes unused locales for macOS builds.
25+
* @param {string} appOutDir
26+
* @param {string} appName
27+
*/
28+
const removeUnusedLocales = (appOutDir, appName) => {
2029
const resourcesPath = path.join(
2130
appOutDir,
2231
`${appName}.app`,
@@ -44,4 +53,21 @@ const removeLocales = async (context) => {
4453
}
4554
};
4655

47-
exports.default = removeLocales;
56+
/**
57+
* Fixes `chrome-sandbox` permissions for Linux builds.
58+
* @param {string} appOutDir
59+
*/
60+
const fixChromeSandboxPermissions = (appOutDir) => {
61+
const chromeSandboxPath = path.join(appOutDir, 'chrome-sandbox');
62+
63+
try {
64+
chownSync(chromeSandboxPath, 0, 0); // Set root ownership
65+
chmodSync(chromeSandboxPath, 0o4755); // Set SUID bit
66+
// biome-ignore lint/suspicious/noConsoleLog: <explanation>
67+
console.log('Fixed chrome-sandbox permissions');
68+
} catch (err) {
69+
console.error('Failed to set chrome-sandbox permissions:', err);
70+
}
71+
};
72+
73+
exports.default = afterPack;

0 commit comments

Comments
 (0)