From 94b8fd4c632d00f46953750b93ccd4352993d669 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 1 Sep 2009 02:02:35 +0000 Subject: [PATCH] Mac installer: add logic for setting BOINC as screensaver under OS 10.6 svn path=/trunk/boinc/; revision=18963 --- checkin_notes | 7 ++++++- mac_installer/PostInstall.cpp | 26 +++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index fbe4b38f82..ec32436291 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7369,4 +7369,9 @@ Eric K 31 Aug 2009 lib/ diagnostics.cpp - +Charlie 31 Aug 2009 + - Mac installer: add logic for setting BOINC as screensaver under OS 10.6. + + mac_installer/ + PostInstall.cpp + \ No newline at end of file diff --git a/mac_installer/PostInstall.cpp b/mac_installer/PostInstall.cpp index 256636af33..39b2579021 100755 --- a/mac_installer/PostInstall.cpp +++ b/mac_installer/PostInstall.cpp @@ -661,10 +661,15 @@ OSErr UpdateAllVisibleUsers(long brandID) Boolean saverAlreadySet = true; FILE *f; OSStatus err; + long response; #ifdef SANDBOX char *p; short i; + err = Gestalt(gestaltSystemVersion, &response); + if (err != noErr) + return err; + grp = getgrnam("admin"); if (grp == NULL) { // Should never happen puts("getgrnam(\"admin\") failed\n"); @@ -714,7 +719,12 @@ OSErr UpdateAllVisibleUsers(long brandID) SetSkinInUserPrefs(dp->d_name, skinName); - f = popen("defaults -currentHost read com.apple.screensaver moduleName", "r"); + if (response < 0x1060) { + f = popen("defaults -currentHost read com.apple.screensaver moduleName", "r"); + } else { + f = popen("defaults -currentHost read com.apple.screensaver moduleDict -dict", "r"); + } + if (f) { PersistentFGets(s, sizeof(s), f); if (!strstr(s, saverName[brandID])) @@ -758,10 +768,16 @@ OSErr UpdateAllVisibleUsers(long brandID) saved_uid = geteuid(); seteuid(pw->pw_uid); // Temporarily set effective uid to this user - sprintf(s, "defaults -currentHost write com.apple.screensaver moduleName %s", saverNameEscaped[brandID]); - system (s); - sprintf(s, "defaults -currentHost write com.apple.screensaver modulePath /Library/Screen\\ Savers/%s.saver", - saverNameEscaped[brandID]); + if (response < 0x1060) { + sprintf(s, "defaults -currentHost write com.apple.screensaver moduleName %s", saverNameEscaped[brandID]); + system (s); + sprintf(s, "defaults -currentHost write com.apple.screensaver modulePath /Library/Screen\\ Savers/%s.saver", + saverNameEscaped[brandID]); + } else { + sprintf(s, "sudo -u %s defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName %s path /Library/Screen\\ Savers/%s.saver", + dp->d_name, saverNameEscaped[brandID], saverNameEscaped[brandID]); + } + printf("Command: %s\n", s); system (s); seteuid(saved_uid); // Set effective uid back to privileged user