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
*/
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
executeCallback = () => {
if(inaccessiblePaths.length > 0) {
dialog.showMessageBoxSync({
buttons: [ "Ok" ],
title: "Update available",
message:
"We don't have permissions to write to all files.\n" +
"Please execute the following command to execute the update:\n" +
`sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"`
});
const updateCommand = `sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"`;
try {
electron.clipboard.writeText(updateCommand);
} catch (error) {
console.error("Failed to copy command to clipboard: %o", error);
}
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;
}