mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Merge pull request #1509 from 21pages/optimize
add polkit and update build.rs
This commit is contained in:
@@ -638,7 +638,13 @@ pub fn quit_gui() {
|
||||
}
|
||||
|
||||
pub fn check_super_user_permission() -> ResultType<bool> {
|
||||
// TODO: replace echo with a rustdesk's program, which is location-fixed and non-gui.
|
||||
let status = std::process::Command::new("pkexec").arg("echo").status()?;
|
||||
let file = "/usr/share/rustdesk/files/polkit";
|
||||
let arg;
|
||||
if std::path::Path::new(file).is_file() {
|
||||
arg = file;
|
||||
} else {
|
||||
arg = "echo";
|
||||
}
|
||||
let status = std::process::Command::new("pkexec").arg(arg).status()?;
|
||||
Ok(status.success() && status.code() == Some(0))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user