From cc53e1401f464181ded8dabff4b20a50e694bf0b Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 19 Nov 2009 10:41:47 +0000 Subject: [PATCH] Mac Uninstaller: change owner and group of BOINC Data to those of the user running the uninstaller svn path=/trunk/boinc/; revision=19650 --- checkin_notes | 4 ++++ mac_installer/uninstall.cpp | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/checkin_notes b/checkin_notes index ae2a7c0793..5abbad52d4 100644 --- a/checkin_notes +++ b/checkin_notes @@ -9367,6 +9367,10 @@ Charlie 18 Nov 2009 Charlie 19 Nov 2009 - Mac MGR: fix bug - don't show exit confirmation dialog if shutting down or restarting system. + - Mac Uninstaller: change owner and group of BOINC Data to those of + the user running the uninstaller. clientgui/ BOINCGUIApp.cpp + mac_installer/ + uninstall.cpp diff --git a/mac_installer/uninstall.cpp b/mac_installer/uninstall.cpp index 8aca8e44b0..9bab3aa488 100644 --- a/mac_installer/uninstall.cpp +++ b/mac_installer/uninstall.cpp @@ -130,8 +130,10 @@ static OSStatus DoUninstall(void) { pid_t coreClientPID = 0; char myRmCommand[MAXPATHLEN+10], plistRmCommand[MAXPATHLEN+10], *p; char notBoot[] = "/Volumes/"; + char cmd[1024]; FSRef theFSRef; int pathOffset, i; + passwd *pw; OSStatus err = noErr; #if TESTING @@ -211,17 +213,25 @@ static OSStatus DoUninstall(void) { system ("rm -rf /Library/Receipts/Progress\\ Thru\\ Processors.pkg"); system ("rm -rf /Library/Receipts/BOINC.pkg"); + // Phase 5: Set BOINC Data owner and group to logged in user // We don't customize BOINC Data directory name for branding // system ("rm -rf \"/Library/Application Support/BOINC Data\""); - - // Phase 5: step through all users and do user-specific cleanup + p = getlogin(); + pw = getpwnam(p); + sprintf(cmd, "chown -R %d:%d \"/Library/Application Support/BOINC Data\"", pw->pw_uid, pw->pw_gid); + system (cmd); + system("chmod -R u+rw-s,g+r-w-s,o+r-w \"/Library/Application Support/BOINC Data\""); + system("chmod 600 \"/Library/Application Support/BOINC Data/gui_rpc_auth.cfg\""); + + // Phase 6: step through all users and do user-specific cleanup CleanupAllVisibleUsers(); system ("dscl . -delete /users/boinc_master"); system ("dscl . -delete /groups/boinc_master"); system ("dscl . -delete /users/boinc_project"); system ("dscl . -delete /groups/boinc_project"); - + + return 0; }