(exec, { certPath })
| 16 | return true |
| 17 | }, |
| 18 | async linux (exec, { certPath }) { |
| 19 | if (!certPath) { |
| 20 | throw new Error('证书路径为空,无法安装根证书。请确认证书文件已生成。') |
| 21 | } |
| 22 | if (!fs.existsSync(certPath)) { |
| 23 | throw new Error(`证书文件不存在: ${certPath}`) |
| 24 | } |
| 25 | const cmds = [`sudo cp ${certPath} /usr/local/share/ca-certificates`, 'sudo update-ca-certificates '] |
| 26 | await exec(cmds) |
| 27 | return true |
| 28 | }, |
| 29 | async mac (exec, { certPath }) { |
| 30 | if (!certPath) { |
| 31 | throw new Error('证书路径为空,无法安装根证书。请确认证书文件已生成。') |