refactor linux install/uninstall service as windows

This commit is contained in:
rustdesk
2023-06-07 23:08:50 +08:00
parent 209e460f3f
commit 7f51f8d976
8 changed files with 309 additions and 195 deletions

View File

@@ -278,13 +278,17 @@ pub fn set_option(key: String, value: String) {
return;
}
}
#[cfg(any(target_os = "windows"))]
#[cfg(any(target_os = "windows", target_os = "linux"))]
{
if crate::platform::is_installed() {
if value == "Y" {
allow_err!(crate::platform::uninstall_service(true));
if crate::platform::uninstall_service(true) {
return;
}
} else {
allow_err!(crate::platform::install_service());
if crate::platform::install_service() {
return;
}
}
return;
}