From 43845ed14583bf78bb3b06761b0e7ed5ebee5050 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 4 Nov 2021 12:11:08 -0400 Subject: [PATCH] Fix auto update not working for AppImage (#4256) --- src/main/app-updater.ts | 10 +++++++++- src/main/index.ts | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/app-updater.ts b/src/main/app-updater.ts index 3dbcc6c4eb..a767a44d4f 100644 --- a/src/main/app-updater.ts +++ b/src/main/app-updater.ts @@ -21,7 +21,7 @@ import { autoUpdater, UpdateInfo } from "electron-updater"; import logger from "./logger"; -import { isDevelopment, isMac, isPublishConfigured, isTestEnv } from "../common/vars"; +import { isDevelopment, isLinux, isMac, isPublishConfigured, isTestEnv } from "../common/vars"; import { delay } from "../common/utils"; import { areArgsUpdateAvailableToBackchannel, AutoUpdateLogPrefix, broadcastMessage, onceCorrect, UpdateAvailableChannel, UpdateAvailableToBackchannel } from "../common/ipc"; import { once } from "lodash"; @@ -48,6 +48,14 @@ function handleAutoUpdateBackChannel(event: Electron.IpcMainEvent, ...[arg]: Upd * download it from itself via electron. */ electronAutoUpdater.checkForUpdates(); + } else if (isLinux) { + /** + * This is a necessary workaround until electron-updater is fixed. + * The problem is that because linux updating is not implemented at + * all via electron. Electron's autoUpdater.quitAndInstall() is never + * called. + */ + electronAutoUpdater.emit("before-quit-for-update"); } autoUpdater.quitAndInstall(true, true); }); diff --git a/src/main/index.ts b/src/main/index.ts index 4315679fec..439d2e6471 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -286,7 +286,10 @@ app.on("activate", (event, hasVisibleWindows) => { */ let blockQuit = !isIntegrationTesting; -autoUpdater.on("before-quit-for-update", () => blockQuit = false); +autoUpdater.on("before-quit-for-update", () => { + logger.debug("Unblocking quit for update"); + blockQuit = false; +}); app.on("will-quit", (event) => { // This is called when the close button of the main window is clicked