add polkit for custom authentication && update build.rs

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages committed 2022-09-13 19:37:52 +08:00
1 parent 64f5f3253c
commit 203d9e39a0
3 files changed
+40 -10

No files matched your search

+8 -2
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))
}