MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / installLinuxPackageUpdate

Function installLinuxPackageUpdate

apps/desktop/src/main/updater.ts:399–427  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

397}
398
399async 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
429function handleLinuxInstallFailure(
430 format: LinuxPackageFormat,

Callers 1

installAppUpdateFunction · 0.85

Calls 5

linuxPackageFormatFunction · 0.85
elevatedInstallScriptFunction · 0.85
setUpdateStateFunction · 0.85
nextStateFromInfoFunction · 0.85

Tested by

no test coverage detected