-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introducing deb and rpm auto-updates (#7060)
introducing RPM and Deb auto-updates by adding a self-identifying `package-type` resource file to each deb/rpm package
- Loading branch information
Showing
21 changed files
with
485 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"app-builder-lib": minor | ||
"electron-updater": minor | ||
--- | ||
|
||
feat: Introducing deb and rpm auto-updates as beta feature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { AllPublishOptions } from "builder-util-runtime" | ||
import { AppAdapter } from "./AppAdapter" | ||
import { DownloadUpdateOptions } from "./AppUpdater" | ||
import { BaseUpdater, InstallOptions } from "./BaseUpdater" | ||
import { DOWNLOAD_PROGRESS } from "./main" | ||
import { findFile } from "./providers/Provider" | ||
|
||
export class DebUpdater extends BaseUpdater { | ||
constructor(options?: AllPublishOptions | null, app?: AppAdapter) { | ||
super(options, app) | ||
} | ||
|
||
/*** @private */ | ||
protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>> { | ||
const provider = downloadUpdateOptions.updateInfoAndProvider.provider | ||
const fileInfo = findFile(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), "deb", ["AppImage", "rpm"])! | ||
return this.executeDownload({ | ||
fileExtension: "deb", | ||
fileInfo, | ||
downloadUpdateOptions, | ||
task: async (updateFile, downloadOptions) => { | ||
if (this.listenerCount(DOWNLOAD_PROGRESS) > 0) { | ||
downloadOptions.onProgress = it => this.emit(DOWNLOAD_PROGRESS, it) | ||
} | ||
await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions) | ||
}, | ||
}) | ||
} | ||
|
||
protected doInstall(options: InstallOptions): boolean { | ||
const sudo = this.wrapSudo() | ||
// pkexec doesn't want the command to be wrapped in " quotes | ||
const wrapper = /pkexec/i.test(sudo) ? "" : `"` | ||
const cmd = ["dpkg", "-i", options.installerPath, "||", "apt-get", "install", "-f", "-y"] | ||
this.spawnSyncLog(sudo, [`${wrapper}/bin/bash`, "-c", `'${cmd.join(" ")}'${wrapper}`]) | ||
return true | ||
} | ||
} |
Oops, something went wrong.