From 2a34e9b31acdd593097572262293650454ab2006 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Tue, 24 Sep 2024 09:08:17 +0700 Subject: [PATCH 1/2] fix: require sudo for cortex update --- engine/controllers/command_line_parser.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/controllers/command_line_parser.cc b/engine/controllers/command_line_parser.cc index 31ace9ffd..e26ef700c 100644 --- a/engine/controllers/command_line_parser.cc +++ b/engine/controllers/command_line_parser.cc @@ -388,6 +388,12 @@ void CommandLineParser::SetupSystemCommands() { update_cmd->group(kSystemGroup); update_cmd->add_option("-v", cml_data_.cortex_version, ""); update_cmd->callback([this] { +#if !defined(_WIN32) + if (getuid()) { + CLI_LOG("You are not root, please run the command with `sudo`"); + return; + } +#endif commands::CortexUpdCmd cuc; cuc.Exec(cml_data_.cortex_version); cml_data_.check_upd = false; From 0bd007c18204c9a3aaa9e29c549884418ce22c19 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Tue, 24 Sep 2024 09:20:22 +0700 Subject: [PATCH 2/2] fix: comment --- engine/controllers/command_line_parser.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/controllers/command_line_parser.cc b/engine/controllers/command_line_parser.cc index e26ef700c..d64104197 100644 --- a/engine/controllers/command_line_parser.cc +++ b/engine/controllers/command_line_parser.cc @@ -390,7 +390,7 @@ void CommandLineParser::SetupSystemCommands() { update_cmd->callback([this] { #if !defined(_WIN32) if (getuid()) { - CLI_LOG("You are not root, please run the command with `sudo`"); + CLI_LOG("Error: Not root user. Please run with sudo."); return; } #endif