*** empty log message ***

svn path=/trunk/boinc/; revision=10685
This commit is contained in:
Charlie Fenton 2006-07-20 02:17:39 +00:00
parent 9d71fb8e78
commit 7a8bfab15c
3 changed files with 48 additions and 29 deletions

View File

@ -7689,7 +7689,11 @@ Charlie 19 July 2006
so BOINC Client will run properly when launched after installation.
- Fix XCode project script phases which were copying wrong info.plist
files into PostInstall.app.
- If creating users and/or groups on OS < 10.3.9, installer requires
a system restart.
mac_installer/
Installer.cpp
PostInstall.cpp
mac_build/
boinc.xcodeproj/

View File

@ -61,9 +61,11 @@ int main(int argc, char *argv[])
CFPropertyListRef propertyListRef = NULL;
CFStringRef restartKey = CFSTR("IFPkgFlagRestartAction");
CFStringRef currentValue = NULL, desiredValue = NULL;
CFStringRef valueRestartRequired = CFSTR("RequiredRestart");
CFStringRef valueLogoutRequired = CFSTR("RequiredLogout");
CFStringRef valueNoRestart = CFSTR("NoRestart");
CFStringRef errorString = NULL;
long response;
Boolean needLogout;
OSStatus err = noErr;
@ -92,8 +94,22 @@ int main(int argc, char *argv[])
strlcat(pkgPath, ".pkg", sizeof(pkgPath));
needLogout = false;
desiredValue = valueNoRestart;
err = Gestalt(gestaltSystemVersion, &response);
if (err != noErr)
return err;
if (response < 0x1040) { // Logout is never needed on OS 10.4 and later
err = IsLogoutNeeded(&needLogout);
desiredValue = needLogout ? valueLogoutRequired : valueNoRestart;
if (needLogout) {
if (response < 0x1039)
desiredValue = valueRestartRequired; // Restart is required before OS 10.3.9
else
desiredValue = valueLogoutRequired; // Logout is requires and sufficient on OS 10.3.9
}
}
strlcpy(infoPlistPath, pkgPath, sizeof(infoPlistPath));
strlcat(infoPlistPath, "/Contents/Info.plist", sizeof(infoPlistPath));
@ -163,8 +179,6 @@ int main(int argc, char *argv[])
OSStatus IsLogoutNeeded(Boolean *result)
{
long response;
OSStatus err = noErr;
passwd *pw = NULL;
group *grp = NULL;
gid_t boinc_master_gid = 0, boinc_project_gid = 0;
@ -176,15 +190,6 @@ OSStatus IsLogoutNeeded(Boolean *result)
*result = true;
err = Gestalt(gestaltSystemVersion, &response);
if (err != noErr)
return err;
if (response >= 0x1040) { // Logout is never needed on OS 10.4 and later
*result = false;
return noErr;
}
grp = getgrnam(boinc_master_group_name);
if (grp == NULL)
return noErr; // Group boinc_master does not exist
@ -284,10 +289,6 @@ OSStatus IsLogoutNeeded(Boolean *result)
closedir(dirp);
*result = false;
return noErr;

View File

@ -42,7 +42,7 @@
void Initialize(void); /* function prototypes */
int DeleteReceipt(void);
OSStatus CheckLogoutRequirement(Boolean *logoutRequired);
OSStatus CheckLogoutRequirement(int *finalAction);
void SetLoginItem(long brandID);
void SetUIDBackToUser (void);
OSErr UpdateAllVisibleUsers(long brandID);
@ -58,7 +58,12 @@ void strip_cr(char *buf);
extern int check_security(char *bundlePath, char *dataPath);
Boolean gQuitFlag = false; /* global */
static Boolean gQuitFlag = false; /* global */
enum { launchWhenDone,
logoutRequired,
restartRequired
};
int main(int argc, char *argv[])
{
@ -74,6 +79,7 @@ int main(int argc, char *argv[])
char *p;
uid_t savedeuid, b_m_uid;
passwd *pw;
int finalInstallAction;
#ifndef SANDBOX
char *q;
group *grp;
@ -175,6 +181,9 @@ int main(int argc, char *argv[])
// print_to_log_file("check_security returned %d (repetition=%d)", err, i);
}
err = CheckLogoutRequirement(&finalInstallAction);
if (finalInstallAction != restartRequired) {
// Wait for BOINC's RPC socket address to become available to user boinc_master, in
// case we are upgrading from a version which did not run as user boinc_master.
savedeuid = geteuid();
@ -192,6 +201,7 @@ int main(int argc, char *argv[])
}
seteuid(savedeuid);
}
#else // ! defined(SANDBOX)
@ -295,18 +305,19 @@ int DeleteReceipt()
int i;
pid_t installerPID = 0;
OSStatus err;
int finalInstallAction;
FSRef fileRef;
Boolean needLogOut;
OSStatus err_fsref;
Initialize();
err = CheckLogoutRequirement(&finalInstallAction);
err = FindProcess ('APPL', 'xins', &installerPSN);
if (err == noErr)
err = GetProcessPID(&installerPSN , &installerPID);
// Launch BOINC Manager when user closes installer or after 15 seconds
for (i=0; i<15; i++) { // Wait 15 seconds max for installer to quit
sleep (1);
if (err == noErr)
@ -325,9 +336,7 @@ int DeleteReceipt()
err_fsref = FSPathMakeRef((StringPtr)"/Applications/BOINCManager.app", &fileRef, NULL);
}
err = CheckLogoutRequirement(&needLogOut);
if (! needLogOut)
if (finalInstallAction == launchWhenDone)
if (err_fsref == noErr)
err = LSOpenFSRef(&fileRef, NULL);
@ -335,7 +344,7 @@ int DeleteReceipt()
}
OSStatus CheckLogoutRequirement(Boolean *logoutRequired)
OSStatus CheckLogoutRequirement(int *finalAction)
{
char path[MAXPATHLEN];
FSRef infoPlistFileRef;
@ -345,12 +354,14 @@ OSStatus CheckLogoutRequirement(Boolean *logoutRequired)
CFPropertyListRef propertyListRef = NULL;
CFStringRef restartKey = CFSTR("IFPkgFlagRestartAction");
CFStringRef currentValue = NULL;
// CFStringRef valueLogoutRequired = CFSTR("RequiredLogout");
// CFStringRef valueRestartRequired = CFSTR("RequiredRestart");
CFStringRef valueLogoutRequired = CFSTR("RequiredLogout");
CFStringRef valueNoRestart = CFSTR("NoRestart");
CFStringRef errorString = NULL;
OSStatus err = noErr;
*logoutRequired = true;
*finalAction = restartRequired;
getcwd(path, sizeof(path));
strlcat(path, "/Contents/Info.plist", sizeof(path));
@ -381,9 +392,12 @@ OSStatus CheckLogoutRequirement(Boolean *logoutRequired)
err = coreFoundationUnknownErr;
}
if (err == noErr)
if (CFStringCompare(currentValue, valueNoRestart, 0) == kCFCompareEqualTo)
*logoutRequired = false;
if (err == noErr) {
if (CFStringCompare(currentValue, valueLogoutRequired, 0) == kCFCompareEqualTo)
*finalAction = logoutRequired;
else if (CFStringCompare(currentValue, valueNoRestart, 0) == kCFCompareEqualTo)
*finalAction = launchWhenDone;
}
if (xmlURL)
CFRelease(xmlURL);