mirror of https://github.com/BOINC/boinc.git
Mac installer: check whether the project server provided the installer_filename.txt file by putting it in the same parent directory as our installer bundle (the bundle's default name is "BOINC Installer.app"). If yes, copy the provided file into the BOINC Data directory. Otherwise create the installer_filename.txt file and write the name of our installer bundle in it.
This commit is contained in:
parent
c324052576
commit
048e9e4800
|
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char pkgPath[MAXPATHLEN];
|
char pkgPath[MAXPATHLEN];
|
||||||
char postInstallAppPath[MAXPATHLEN];
|
char postInstallAppPath[MAXPATHLEN];
|
||||||
char temp[MAXPATHLEN];
|
char temp[MAXPATHLEN], temp2[MAXPATHLEN];
|
||||||
char brand[64], s[256];
|
char brand[64], s[256];
|
||||||
char *p;
|
char *p;
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
|
@ -117,15 +117,35 @@ int main(int argc, char *argv[])
|
||||||
strlcat(postInstallAppPath, "PostInstall.app", sizeof(postInstallAppPath));
|
strlcat(postInstallAppPath, "PostInstall.app", sizeof(postInstallAppPath));
|
||||||
|
|
||||||
p = strrchr(temp, '/'); // Point to name of this application (e.g., "BOINC Installer.app")
|
p = strrchr(temp, '/'); // Point to name of this application (e.g., "BOINC Installer.app")
|
||||||
if (p == NULL)
|
if (p == NULL) {
|
||||||
p = temp - 1;
|
p = temp - 1;
|
||||||
|
} else {
|
||||||
|
*p = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete any old project auto-attach key file from our temp directory
|
||||||
|
snprintf(temp2, sizeof(temp2), "rm -dfR \"/tmp/%s/%s\"", tempDirName, INSTALLER_FILENAME_FILENAME);
|
||||||
|
err = callPosixSpawn(temp2);
|
||||||
|
REPORT_ERROR(err);
|
||||||
|
|
||||||
// write installer filename to a temp file
|
// Write a file containing the project auto-attach key into our temp
|
||||||
// PostInstall.app will copy it into the BOINC Data directory
|
// directory because the BOINC Data directory may not yet exist.
|
||||||
snprintf(temp, sizeof(temp), "tmp/%s/%s", tempDirName, INSTALLER_FILENAME_FILENAME);
|
// PostInstall.app will copy it into the BOINC Data directory laer
|
||||||
FILE* f = fopen(temp, "w");
|
snprintf(temp2, sizeof(temp2), "%s/%s", temp, INSTALLER_FILENAME_FILENAME);
|
||||||
fputs(p+1, f);
|
if (boinc_file_exists(temp2)) {
|
||||||
fclose(f);
|
// If the project server put installer_filename.txt file in the same
|
||||||
|
// parent directory as this installer, copy it into our temp directory
|
||||||
|
snprintf(temp2, sizeof(temp2), "cp \"%s/%s\" \"/tmp/%s/%s\"", temp, INSTALLER_FILENAME_FILENAME, tempDirName, INSTALLER_FILENAME_FILENAME);
|
||||||
|
err = callPosixSpawn(temp2);
|
||||||
|
REPORT_ERROR(err);
|
||||||
|
} else {
|
||||||
|
// Create an installer_filename.txt file containing our
|
||||||
|
// installer's filename and put it in our temp directory
|
||||||
|
snprintf(temp2, sizeof(temp2), "/tmp/%s/%s", tempDirName, INSTALLER_FILENAME_FILENAME);
|
||||||
|
FILE* f = fopen(temp2, "w");
|
||||||
|
fputs(p+1, f);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
// To allow for branding, assume name of installer package inside bundle corresponds to name of this application
|
// To allow for branding, assume name of installer package inside bundle corresponds to name of this application
|
||||||
strlcpy(brand, p+1, sizeof(brand));
|
strlcpy(brand, p+1, sizeof(brand));
|
||||||
|
|
Loading…
Reference in New Issue