Fixed the linux updater

This commit is contained in:
WolverinDEV 2021-05-02 11:30:59 +02:00
parent dbb486209b
commit 44e03dd00f
1 changed files with 14 additions and 8 deletions

View File

@ -655,6 +655,7 @@ export async function availableClientUpdate() : Promise<UpdateVersion | undefine
} }
/** /**
* The `callbackLog` might get called after this method exists and as soon you call the `callbackExecute`.
* @returns The callback to execute the update * @returns The callback to execute the update
*/ */
export async function prepareUpdateExecute(targetVersion: UpdateVersion, callbackStats: UpdateStatsCallback, callbackLog: UpdateLogCallback) : Promise<{ callbackExecute: () => void, callbackAbort: () => void }> { export async function prepareUpdateExecute(targetVersion: UpdateVersion, callbackStats: UpdateStatsCallback, callbackLog: UpdateLogCallback) : Promise<{ callbackExecute: () => void, callbackAbort: () => void }> {
@ -715,14 +716,19 @@ export async function prepareUpdateExecute(targetVersion: UpdateVersion, callbac
//We have to unpack it later //We have to unpack it later
executeCallback = () => { executeCallback = () => {
if(inaccessiblePaths.length > 0) { if(inaccessiblePaths.length > 0) {
dialog.showMessageBoxSync({ const updateCommand = `sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"`;
buttons: [ "Ok" ], try {
title: "Update available", electron.clipboard.writeText(updateCommand);
message: } catch (error) {
"We don't have permissions to write to all files.\n" + console.error("Failed to copy command to clipboard: %o", error);
"Please execute the following command to execute the update:\n" + }
`sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"`
}); callbackLog("error",
"We don't have permissions to write to all files.\n" +
"Please close this client and execute the following command:\n" +
`sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"` + "\n\n" +
"We've already copied that command to your clipboard."
);
return; return;
} }