mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-05-17 02:07:29 +08:00
d722728ee0
将根目录的运维脚本统一收纳到 scripts/,并把脚本内的相对路径 改为基于 __dirname,避免在仓库子目录执行时找不到 node_modules。
22 lines
760 B
JavaScript
22 lines
760 B
JavaScript
/**
|
|
* 修复 Linux 下 Electron sandbox 权限问题
|
|
* chrome-sandbox 需要 root 拥有且权限为 4755
|
|
*
|
|
* 注意:此脚本需要 sudo 权限,仅在 CI 环境或手动执行时使用
|
|
* 用法:sudo npm run fix-sandbox
|
|
*/
|
|
const { execSync } = require('child_process');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
if (process.platform === 'linux') {
|
|
const sandboxPath = path.resolve(__dirname, '../node_modules/electron/dist/chrome-sandbox');
|
|
if (fs.existsSync(sandboxPath)) {
|
|
execSync(`sudo chown root:root ${sandboxPath}`);
|
|
execSync(`sudo chmod 4755 ${sandboxPath}`);
|
|
console.log('[fix-sandbox] chrome-sandbox permissions fixed');
|
|
} else {
|
|
console.log('[fix-sandbox] chrome-sandbox not found, skipping');
|
|
}
|
|
}
|