Merge pull request #1509 from 21pages/optimize

add polkit and update build.rs
This commit is contained in:
RustDesk
2022-09-13 21:56:13 +08:00
committed by GitHub
4 changed files with 49 additions and 25 deletions

View File

@@ -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))
}