Fixed some minor updater bugs on linux
This commit is contained in:
parent
177d6582ea
commit
a57246bb8b
@ -713,10 +713,17 @@ export async function prepareUpdateExecute(targetVersion: UpdateVersion, callbac
|
|||||||
console.log("Will prompt the user to execute a command");
|
console.log("Will prompt the user to execute a command");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.chmodSync(updateInstallerExecutable, 0o755);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to make update executable executable: %o", error);
|
||||||
|
throw "failed to make update executable executable";
|
||||||
|
}
|
||||||
|
|
||||||
//We have to unpack it later
|
//We have to unpack it later
|
||||||
executeCallback = () => {
|
executeCallback = () => {
|
||||||
if(inaccessiblePaths.length > 0) {
|
if(inaccessiblePaths.length > 0) {
|
||||||
const updateCommand = `sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"`;
|
const updateCommand = `sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}" no-daemon`;
|
||||||
try {
|
try {
|
||||||
electron.clipboard.writeText(updateCommand);
|
electron.clipboard.writeText(updateCommand);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -728,7 +735,7 @@ export async function prepareUpdateExecute(targetVersion: UpdateVersion, callbac
|
|||||||
"Please do the following steps:\n" +
|
"Please do the following steps:\n" +
|
||||||
"1. Close this client\n" +
|
"1. Close this client\n" +
|
||||||
"2. Execute this command:\n" +
|
"2. Execute this command:\n" +
|
||||||
` sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"` + "\n" +
|
" " + updateCommand + "\n" +
|
||||||
"3. Start the client again\n\n" +
|
"3. Start the client again\n\n" +
|
||||||
"Note:\n" +
|
"Note:\n" +
|
||||||
"We've already copied that command to your clipboard."
|
"We've already copied that command to your clipboard."
|
||||||
|
@ -115,6 +115,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(argc >= 4 && std::string_view{argv[3]} != "no-daemon") {
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
logger::info("Deamonize process");
|
logger::info("Deamonize process");
|
||||||
if(!daemonize()) {
|
if(!daemonize()) {
|
||||||
@ -123,6 +124,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
logger::info("Deamonized process");
|
logger::info("Deamonized process");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if(requires_permission_elevation()) {
|
if(requires_permission_elevation()) {
|
||||||
|
@ -46,7 +46,11 @@ using namespace std;
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
bool is_executable(const std::string& file) {
|
bool is_executable(const std::string& file) {
|
||||||
|
chmod(file.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||||
return access(file.c_str(), F_OK | X_OK) == 0;
|
return access(file.c_str(), F_OK | X_OK) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +89,7 @@ inline std::string build_callback_info(const std::string& error_id, const std::s
|
|||||||
void execute_callback_fail_exit(const std::string& error, const std::string& error_message) {
|
void execute_callback_fail_exit(const std::string& error, const std::string& error_message) {
|
||||||
file::rollback();
|
file::rollback();
|
||||||
|
|
||||||
|
//int chmod(const char *path, mode_t mode);
|
||||||
if(!is_executable(config::callback_file)) {
|
if(!is_executable(config::callback_file)) {
|
||||||
logger::fatal("callback file (%s) is not executable! Ignoring fail callback", config::callback_file.c_str());
|
logger::fatal("callback file (%s) is not executable! Ignoring fail callback", config::callback_file.c_str());
|
||||||
logger::flush();
|
logger::flush();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user