diff --git a/modules/core/app-updater/index.ts b/modules/core/app-updater/index.ts index 3d46640..5f691da 100644 --- a/modules/core/app-updater/index.ts +++ b/modules/core/app-updater/index.ts @@ -725,8 +725,12 @@ export async function prepareUpdateExecute(targetVersion: UpdateVersion, callbac 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" + + "Please do the following steps:\n" + + "1. Close this client\n" + + "2. Execute this command:\n" + + ` sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"` + "\n" + + "3. Start the client again\n\n" + + "Note:\n" + "We've already copied that command to your clipboard." ); return; diff --git a/modules/core/main.ts b/modules/core/main.ts index f450383..0648bb4 100644 --- a/modules/core/main.ts +++ b/modules/core/main.ts @@ -46,6 +46,8 @@ async function handleAppReady() { } console.log("Update success: %o. Update data: %o", success, data); + const isRootExec = process.getuid && process.getuid() === 0; + let title; let type; let message; @@ -63,10 +65,14 @@ async function handleAppReady() { message = "Update has been successfully installed!\nWhat do you want to do next?"; - buttons.push({ - key: "Launch client", - callback: async () => false - }); + if(!isRootExec) { + /* Don't start the app automatically if we're still having root privileges */ + buttons.push({ + key: "Launch client", + callback: async () => false + }); + } + if(data.parse_success && data.log_file) { buttons.push({ key: "Open update log", @@ -90,17 +96,21 @@ async function handleAppReady() { message += "\nUnknown error! Lookup the console for more details."; } - buttons.push({ - key: "Ignore", - callback: async () => false - }); - buttons.push({ - key: "Retry update", - callback: async () => { - await showUpdateWindow(); - return true; - } - }); + if(!isRootExec) { + /* Don't start the app automatically if we're still having root privileges */ + buttons.push({ + key: "Ignore", + callback: async () => false + }); + buttons.push({ + key: "Retry update", + callback: async () => { + await showUpdateWindow(); + return true; + } + }); + } + if(data.parse_success && data.log_file) { buttons.push({ key: "Open update log",