Mac uninstaller: Fixes for fast user switching support

This commit is contained in:
Charlie Fenton 2014-03-07 04:28:32 -08:00
parent 0cdee0af4e
commit 0d7909a3f9
1 changed files with 44 additions and 7 deletions

View File

@ -319,6 +319,7 @@ int main(int argc, char *argv[])
static OSStatus DoUninstall(void) { static OSStatus DoUninstall(void) {
pid_t coreClientPID = 0; pid_t coreClientPID = 0;
pid_t BOINCManagerPID = 0;
char cmd[1024]; char cmd[1024];
char *p; char *p;
passwd *pw; passwd *pw;
@ -334,8 +335,36 @@ static OSStatus DoUninstall(void) {
ShowMessage(false, false, false, "Permission OK after relaunch"); ShowMessage(false, false, false, "Permission OK after relaunch");
#endif #endif
QuitOneProcess('BNC!'); // Quit any old instance of BOINC manager //TODO: It would be nice to get the app name from the bundle ID or signature
// so we don't have to try all 4 and to allow for future branded versions
for (;;) {
BOINCManagerPID = FindProcessPID("BOINCManager", 0);
if (BOINCManagerPID == 0) break;
kill(BOINCManagerPID, SIGTERM);
sleep(2); sleep(2);
}
for (;;) {
BOINCManagerPID = FindProcessPID("GridRepublic Desktop", 0);
if (BOINCManagerPID == 0) break;
kill(BOINCManagerPID, SIGTERM);
sleep(2);
}
for (;;) {
BOINCManagerPID = FindProcessPID("Progress Thru Processors Desktop", 0);
if (BOINCManagerPID == 0) break;
kill(BOINCManagerPID, SIGTERM);
sleep(2);
}
for (;;) {
BOINCManagerPID = FindProcessPID("Charity Engine Desktop", 0);
if (BOINCManagerPID == 0) break;
kill(BOINCManagerPID, SIGTERM);
sleep(2);
}
// Core Client may still be running if it was started without Manager // Core Client may still be running if it was started without Manager
coreClientPID = FindProcessPID("boinc", 0); coreClientPID = FindProcessPID("boinc", 0);
@ -395,6 +424,10 @@ static OSStatus DoUninstall(void) {
// Phase 4: Delete our files and directories at our installer's default locations // Phase 4: Delete our files and directories at our installer's default locations
// Remove everything we've installed, whether BOINC, GridRepublic, Progress Thru Processors or // Remove everything we've installed, whether BOINC, GridRepublic, Progress Thru Processors or
// Charity Engine // Charity Engine
//TODO: It would be nice to get the app name from the bundle ID or signature
// so we don't have to try all 4 and to allow for future branded versions
// These first 4 should already have been deleted by the above code, but do them anyway for safety // These first 4 should already have been deleted by the above code, but do them anyway for safety
system ("rm -rf /Applications/BOINCManager.app"); system ("rm -rf /Applications/BOINCManager.app");
system ("rm -rf \"/Library/Screen Savers/BOINCSaver.saver\""); system ("rm -rf \"/Library/Screen Savers/BOINCSaver.saver\"");
@ -402,11 +435,11 @@ static OSStatus DoUninstall(void) {
system ("rm -rf \"/Applications/GridRepublic Desktop.app\""); system ("rm -rf \"/Applications/GridRepublic Desktop.app\"");
system ("rm -rf \"/Library/Screen Savers/GridRepublic.saver\""); system ("rm -rf \"/Library/Screen Savers/GridRepublic.saver\"");
system ("rm -rf \"/Applications/Progress\\ Thru\\ Processors\\ Desktop.app\""); system ("rm -rf \"/Applications/Progress Thru Processors Desktop.app\"");
system ("rm -rf \"/Library/Screen Savers/Progress\\ Thru\\ Processors.saver\""); system ("rm -rf \"/Library/Screen Savers/Progress Thru Processors.saver\"");
system ("rm -rf \"/Applications/Charity\\ Engine\\ Desktop.app\""); system ("rm -rf \"/Applications/Charity Engine Desktop.app\"");
system ("rm -rf \"/Library/Screen Savers/Charity\\ Engine.saver\""); system ("rm -rf \"/Library/Screen Savers/Charity Engine.saver\"");
// Delete any receipt from an older installer (which had // Delete any receipt from an older installer (which had
// a wrapper application around the installer package.) // a wrapper application around the installer package.)
@ -736,6 +769,10 @@ static OSStatus CleanupAllVisibleUsers(void)
// sprintf(s, "rm -f \"/Users/%s/Library/Preferences/BOINC Manager Preferences\"", human_user_name); // sprintf(s, "rm -f \"/Users/%s/Library/Preferences/BOINC Manager Preferences\"", human_user_name);
// system (s); // system (s);
// Delete per-user BOINC Manager and screensaver files
sprintf(s, "rm -fR \"/Users/%s/Library/Application Support/BOINC\"", human_user_name);
system (s);
// Set screensaver to "Computer Name" default screensaver only // Set screensaver to "Computer Name" default screensaver only
// if it was BOINC, GridRepublic, Progress Thru Processors or Charity Engine. // if it was BOINC, GridRepublic, Progress Thru Processors or Charity Engine.
changeSaver = false; changeSaver = false;