From da0d20c6fbd5d72f901a4b0171d85aba9bd159f5 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Mon, 7 Jan 2008 03:47:56 +0000 Subject: [PATCH] Mac: installer runs new Client as daemon via launchd if system is set up to do that. svn path=/trunk/boinc/; revision=14478 --- checkin_notes | 6 +++++- mac_installer/PostInstall.cpp | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/checkin_notes b/checkin_notes index fd63a62d06..92069c2a09 100644 --- a/checkin_notes +++ b/checkin_notes @@ -111,11 +111,15 @@ David Jan 4 2008 Charlie Jan 6 2008 - Mac Client: more idle time tweaks to allow running as a daemon by using Mac OS X's launchd mechanism. - - Mac: Update script which sets BOINC up to run as a daemon so it + - Mac Installer: if system is set up to run BOINC Client as a daemon + using launchd, use launchctl to launch newly installed Client as + a daemon. client/ hostinfo_unix.C main.C + mac_installer/ + PostInstall.cpp David Jan 6 2007 - web: bug fixes diff --git a/mac_installer/PostInstall.cpp b/mac_installer/PostInstall.cpp index f23ff02e08..944e166e51 100755 --- a/mac_installer/PostInstall.cpp +++ b/mac_installer/PostInstall.cpp @@ -352,9 +352,16 @@ int DeleteReceipt() err_fsref = FSPathMakeRef((StringPtr)"/Applications/BOINCManager.app", &fileRef, NULL); } - if (finalInstallAction == launchWhenDone) - if (err_fsref == noErr) + if (finalInstallAction == launchWhenDone) { + if (err_fsref == noErr) { + // If system is set up to run BOINC Client as a daemon using launchd, launch it + // as a daemon and allow time for client to start before launching BOINC Manager. + system("launchctl unload /Library/LaunchDaemons/edu.berkeley.boinc.plist"); + i = system("launchctl load /Library/LaunchDaemons/edu.berkeley.boinc.plist"); + if (i == 0) sleep (2); err = LSOpenFSRef(&fileRef, NULL); + } + } return 0; }