sync config if enable mac service

This commit is contained in:
rustdesk 2022-01-17 12:38:44 +08:00
parent 5af1258454
commit e0637f966a
2 changed files with 16 additions and 5 deletions

View File

@ -131,7 +131,7 @@ pub fn is_installed_daemon(prompt: bool) -> bool {
.arg(&get_active_username()) .arg(&get_active_username())
.spawn() .spawn()
{ {
Ok(mut proc) => { Ok(_) => {
std::process::exit(0); std::process::exit(0);
} }
Err(e) => { Err(e) => {
@ -157,6 +157,7 @@ pub fn launch(load: bool) {
std::process::Command::new("osascript") std::process::Command::new("osascript")
.arg("-e") .arg("-e")
.arg(script_body) .arg(script_body)
.arg(&get_active_username())
.spawn() .spawn()
.ok(); .ok();
} }

View File

@ -1,6 +1,16 @@
set sh1 to "launchctl load -w /Library/LaunchDaemons/com.carriez.rustdesk_service.plist;" on run {user}
set sh2 to "launchctl load -w /Library/LaunchAgents/com.carriez.rustdesk_server.plist;"
do shell script sh1 with prompt "RustDesk want to launch daemon" with administrator privileges set sh1 to "cp -rf /Users/" & user & "/Library/Preferences/com.carriez.RustDesk/RustDesk.toml /var/root/Library/Preferences/com.carriez.RustDesk/;"
do shell script sh2
set sh2 to "cp -rf /Users/" & user & "/Library/Preferences/com.carriez.RustDesk/RustDesk2.toml /var/root/Library/Preferences/com.carriez.RustDesk/;"
set sh3 to "launchctl load -w /Library/LaunchDaemons/com.carriez.rustdesk_service.plist;"
set sh4 to "launchctl load -w /Library/LaunchAgents/com.carriez.rustdesk_server.plist;"
set sh to sh1 & sh2 & sh3
do shell script sh with prompt "RustDesk want to launch daemon" with administrator privileges
do shell script sh4
end run