mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=10685
This commit is contained in:
parent
9d71fb8e78
commit
7a8bfab15c
|
@ -7689,7 +7689,11 @@ Charlie 19 July 2006
|
||||||
so BOINC Client will run properly when launched after installation.
|
so BOINC Client will run properly when launched after installation.
|
||||||
- Fix XCode project script phases which were copying wrong info.plist
|
- Fix XCode project script phases which were copying wrong info.plist
|
||||||
files into PostInstall.app.
|
files into PostInstall.app.
|
||||||
|
- If creating users and/or groups on OS < 10.3.9, installer requires
|
||||||
|
a system restart.
|
||||||
|
|
||||||
mac_installer/
|
mac_installer/
|
||||||
|
Installer.cpp
|
||||||
PostInstall.cpp
|
PostInstall.cpp
|
||||||
mac_build/
|
mac_build/
|
||||||
boinc.xcodeproj/
|
boinc.xcodeproj/
|
||||||
|
|
|
@ -61,9 +61,11 @@ int main(int argc, char *argv[])
|
||||||
CFPropertyListRef propertyListRef = NULL;
|
CFPropertyListRef propertyListRef = NULL;
|
||||||
CFStringRef restartKey = CFSTR("IFPkgFlagRestartAction");
|
CFStringRef restartKey = CFSTR("IFPkgFlagRestartAction");
|
||||||
CFStringRef currentValue = NULL, desiredValue = NULL;
|
CFStringRef currentValue = NULL, desiredValue = NULL;
|
||||||
|
CFStringRef valueRestartRequired = CFSTR("RequiredRestart");
|
||||||
CFStringRef valueLogoutRequired = CFSTR("RequiredLogout");
|
CFStringRef valueLogoutRequired = CFSTR("RequiredLogout");
|
||||||
CFStringRef valueNoRestart = CFSTR("NoRestart");
|
CFStringRef valueNoRestart = CFSTR("NoRestart");
|
||||||
CFStringRef errorString = NULL;
|
CFStringRef errorString = NULL;
|
||||||
|
long response;
|
||||||
Boolean needLogout;
|
Boolean needLogout;
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
|
|
||||||
|
@ -92,8 +94,22 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
strlcat(pkgPath, ".pkg", sizeof(pkgPath));
|
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);
|
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));
|
strlcpy(infoPlistPath, pkgPath, sizeof(infoPlistPath));
|
||||||
strlcat(infoPlistPath, "/Contents/Info.plist", sizeof(infoPlistPath));
|
strlcat(infoPlistPath, "/Contents/Info.plist", sizeof(infoPlistPath));
|
||||||
|
@ -163,8 +179,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
OSStatus IsLogoutNeeded(Boolean *result)
|
OSStatus IsLogoutNeeded(Boolean *result)
|
||||||
{
|
{
|
||||||
long response;
|
|
||||||
OSStatus err = noErr;
|
|
||||||
passwd *pw = NULL;
|
passwd *pw = NULL;
|
||||||
group *grp = NULL;
|
group *grp = NULL;
|
||||||
gid_t boinc_master_gid = 0, boinc_project_gid = 0;
|
gid_t boinc_master_gid = 0, boinc_project_gid = 0;
|
||||||
|
@ -176,15 +190,6 @@ OSStatus IsLogoutNeeded(Boolean *result)
|
||||||
|
|
||||||
*result = true;
|
*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);
|
grp = getgrnam(boinc_master_group_name);
|
||||||
if (grp == NULL)
|
if (grp == NULL)
|
||||||
return noErr; // Group boinc_master does not exist
|
return noErr; // Group boinc_master does not exist
|
||||||
|
@ -284,10 +289,6 @@ OSStatus IsLogoutNeeded(Boolean *result)
|
||||||
|
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*result = false;
|
*result = false;
|
||||||
|
|
||||||
return noErr;
|
return noErr;
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
void Initialize(void); /* function prototypes */
|
void Initialize(void); /* function prototypes */
|
||||||
int DeleteReceipt(void);
|
int DeleteReceipt(void);
|
||||||
OSStatus CheckLogoutRequirement(Boolean *logoutRequired);
|
OSStatus CheckLogoutRequirement(int *finalAction);
|
||||||
void SetLoginItem(long brandID);
|
void SetLoginItem(long brandID);
|
||||||
void SetUIDBackToUser (void);
|
void SetUIDBackToUser (void);
|
||||||
OSErr UpdateAllVisibleUsers(long brandID);
|
OSErr UpdateAllVisibleUsers(long brandID);
|
||||||
|
@ -58,7 +58,12 @@ void strip_cr(char *buf);
|
||||||
extern int check_security(char *bundlePath, char *dataPath);
|
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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -74,6 +79,7 @@ int main(int argc, char *argv[])
|
||||||
char *p;
|
char *p;
|
||||||
uid_t savedeuid, b_m_uid;
|
uid_t savedeuid, b_m_uid;
|
||||||
passwd *pw;
|
passwd *pw;
|
||||||
|
int finalInstallAction;
|
||||||
#ifndef SANDBOX
|
#ifndef SANDBOX
|
||||||
char *q;
|
char *q;
|
||||||
group *grp;
|
group *grp;
|
||||||
|
@ -175,6 +181,9 @@ int main(int argc, char *argv[])
|
||||||
// print_to_log_file("check_security returned %d (repetition=%d)", err, i);
|
// 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
|
// 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.
|
// case we are upgrading from a version which did not run as user boinc_master.
|
||||||
savedeuid = geteuid();
|
savedeuid = geteuid();
|
||||||
|
@ -192,6 +201,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
seteuid(savedeuid);
|
seteuid(savedeuid);
|
||||||
|
}
|
||||||
|
|
||||||
#else // ! defined(SANDBOX)
|
#else // ! defined(SANDBOX)
|
||||||
|
|
||||||
|
@ -295,18 +305,19 @@ int DeleteReceipt()
|
||||||
int i;
|
int i;
|
||||||
pid_t installerPID = 0;
|
pid_t installerPID = 0;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
int finalInstallAction;
|
||||||
FSRef fileRef;
|
FSRef fileRef;
|
||||||
Boolean needLogOut;
|
|
||||||
OSStatus err_fsref;
|
OSStatus err_fsref;
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|
||||||
|
err = CheckLogoutRequirement(&finalInstallAction);
|
||||||
|
|
||||||
err = FindProcess ('APPL', 'xins', &installerPSN);
|
err = FindProcess ('APPL', 'xins', &installerPSN);
|
||||||
if (err == noErr)
|
if (err == noErr)
|
||||||
err = GetProcessPID(&installerPSN , &installerPID);
|
err = GetProcessPID(&installerPSN , &installerPID);
|
||||||
|
|
||||||
// Launch BOINC Manager when user closes installer or after 15 seconds
|
// 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
|
for (i=0; i<15; i++) { // Wait 15 seconds max for installer to quit
|
||||||
sleep (1);
|
sleep (1);
|
||||||
if (err == noErr)
|
if (err == noErr)
|
||||||
|
@ -325,9 +336,7 @@ int DeleteReceipt()
|
||||||
err_fsref = FSPathMakeRef((StringPtr)"/Applications/BOINCManager.app", &fileRef, NULL);
|
err_fsref = FSPathMakeRef((StringPtr)"/Applications/BOINCManager.app", &fileRef, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = CheckLogoutRequirement(&needLogOut);
|
if (finalInstallAction == launchWhenDone)
|
||||||
|
|
||||||
if (! needLogOut)
|
|
||||||
if (err_fsref == noErr)
|
if (err_fsref == noErr)
|
||||||
err = LSOpenFSRef(&fileRef, NULL);
|
err = LSOpenFSRef(&fileRef, NULL);
|
||||||
|
|
||||||
|
@ -335,7 +344,7 @@ int DeleteReceipt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OSStatus CheckLogoutRequirement(Boolean *logoutRequired)
|
OSStatus CheckLogoutRequirement(int *finalAction)
|
||||||
{
|
{
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
FSRef infoPlistFileRef;
|
FSRef infoPlistFileRef;
|
||||||
|
@ -345,12 +354,14 @@ OSStatus CheckLogoutRequirement(Boolean *logoutRequired)
|
||||||
CFPropertyListRef propertyListRef = NULL;
|
CFPropertyListRef propertyListRef = NULL;
|
||||||
CFStringRef restartKey = CFSTR("IFPkgFlagRestartAction");
|
CFStringRef restartKey = CFSTR("IFPkgFlagRestartAction");
|
||||||
CFStringRef currentValue = NULL;
|
CFStringRef currentValue = NULL;
|
||||||
// CFStringRef valueLogoutRequired = CFSTR("RequiredLogout");
|
// CFStringRef valueRestartRequired = CFSTR("RequiredRestart");
|
||||||
|
CFStringRef valueLogoutRequired = CFSTR("RequiredLogout");
|
||||||
CFStringRef valueNoRestart = CFSTR("NoRestart");
|
CFStringRef valueNoRestart = CFSTR("NoRestart");
|
||||||
CFStringRef errorString = NULL;
|
CFStringRef errorString = NULL;
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
|
|
||||||
*logoutRequired = true;
|
|
||||||
|
*finalAction = restartRequired;
|
||||||
|
|
||||||
getcwd(path, sizeof(path));
|
getcwd(path, sizeof(path));
|
||||||
strlcat(path, "/Contents/Info.plist", sizeof(path));
|
strlcat(path, "/Contents/Info.plist", sizeof(path));
|
||||||
|
@ -381,9 +392,12 @@ OSStatus CheckLogoutRequirement(Boolean *logoutRequired)
|
||||||
err = coreFoundationUnknownErr;
|
err = coreFoundationUnknownErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == noErr)
|
if (err == noErr) {
|
||||||
if (CFStringCompare(currentValue, valueNoRestart, 0) == kCFCompareEqualTo)
|
if (CFStringCompare(currentValue, valueLogoutRequired, 0) == kCFCompareEqualTo)
|
||||||
*logoutRequired = false;
|
*finalAction = logoutRequired;
|
||||||
|
else if (CFStringCompare(currentValue, valueNoRestart, 0) == kCFCompareEqualTo)
|
||||||
|
*finalAction = launchWhenDone;
|
||||||
|
}
|
||||||
|
|
||||||
if (xmlURL)
|
if (xmlURL)
|
||||||
CFRelease(xmlURL);
|
CFRelease(xmlURL);
|
||||||
|
|
Loading…
Reference in New Issue