(file: string)
| 397 | } |
| 398 | |
| 399 | async function installLinuxPackageUpdate(file: string): Promise<void> { |
| 400 | const format = linuxPackageFormat(file) |
| 401 | const script = elevatedInstallScript(format, file) |
| 402 | if (!script) { |
| 403 | // Unknown format — defer to electron-updater's own handling. |
| 404 | updater?.quitAndInstall() |
| 405 | return |
| 406 | } |
| 407 | |
| 408 | setUpdateState( |
| 409 | nextStateFromInfo( |
| 410 | 'downloaded', |
| 411 | lastInfo, |
| 412 | `Installing ZenNotes ${lastInfo?.version ?? ''}… approve the administrator prompt to finish.` |
| 413 | ) |
| 414 | ) |
| 415 | |
| 416 | try { |
| 417 | // pkexec shows a graphical password prompt and runs the install as root. |
| 418 | await execFileAsync('pkexec', ['sh', '-c', script]) |
| 419 | } catch (error) { |
| 420 | handleLinuxInstallFailure(format, file, error) |
| 421 | return |
| 422 | } |
| 423 | |
| 424 | // The package was replaced on disk; relaunch into the new version. |
| 425 | app.relaunch() |
| 426 | app.quit() |
| 427 | } |
| 428 | |
| 429 | function handleLinuxInstallFailure( |
| 430 | format: LinuxPackageFormat, |
no test coverage detected