Files
2025-09-02 19:37:17 +03:00

36 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// scripts/afterPack.js
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
module.exports = async function afterPack(context) {
const { appOutDir, electronPlatformName } = context;
if (!electronPlatformName.toLowerCase().includes('linux')) return;
const chromeSandbox = path.join(appOutDir, 'chrome-sandbox');
if (!fs.existsSync(chromeSandbox)) {
console.log('️ chrome-sandbox not found, skipping.');
return;
}
console.log('🔧 Fixing chrome-sandbox permissions...');
try {
// Set setuid bit (rwsr-xr-x)
execSync(`chmod 4755 "${chromeSandbox}"`, { stdio: 'inherit' });
// // Needs root to succeed; if not root, we warn but continue
// try {
// execSync(`chown root:root "${chromeSandbox}"`, { stdio: 'inherit' });
// } catch (e) {
// console.warn(
// '⚠️ chown root:root failed (not running as root?). AppImage may refuse to run the sandbox.'
// );
// }
console.log('✅ chrome-sandbox permissions fixed.');
} catch (e) {
console.warn('⚠️ Failed to set chrome-sandbox permissions:', e.message);
}
};