-
-
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: implement autoupdates for
pacman
(#8394)
- Loading branch information
Showing
12 changed files
with
108 additions
and
10 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: Implement autoupdates for pacman |
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,41 @@ | ||
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 PacmanUpdater 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), "pacman", ["AppImage", "deb", "rpm"])! | ||
return this.executeDownload({ | ||
fileExtension: "pacman", | ||
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 = ["pacman", "-U", "--noconfirm", options.installerPath] | ||
this.spawnSyncLog(sudo, [`${wrapper}/bin/bash`, "-c", `'${cmd.join(" ")}'${wrapper}`]) | ||
if (options.isForceRunAfter) { | ||
this.app.relaunch() | ||
} | ||
return true | ||
} | ||
} |
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