Skip to content

Commit

Permalink
Mac Installer: Changes for integrated BOINC+VirtualBox Mac installer
Browse files Browse the repository at this point in the history
svn path=/trunk/boinc/; revision=25000
  • Loading branch information
Charlie Fenton committed Jan 6, 2012
1 parent 06af098 commit 9502d33
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 12 deletions.
13 changes: 12 additions & 1 deletion checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,20 @@ David 5 Jan 2012
lib/
gui_rpc_client_ops.cpp

Rom 3 Jan 2012
Charlie 5 Jan 2012
- client: Restore scaling factor for AMD OpenCL devices on Macs with
OpenCL version < 1.2.

client/
coproc_detect.cpp

Charlie 6 Jan 2012
- Mac Installer: Changes for integrated BOINC+VirtualBox Mac installer.

clientgui/
mac/
SetVersion.cpp
mac_installer/
Description.plist
Installer.cpp
release_boinc.sh
64 changes: 60 additions & 4 deletions clientgui/mac/SetVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
int IsFileCurrent(char* filePath);
int FixInfoPlistFile(char* myPath);
int FixInfoPlist_Strings(char* myPath, char* brand);
int MakeInstallerInfoPlistFile(char* myPath, char* brand);
int MakeBOINCPackageInfoPlistFile(char* myPath, char* brand);
int MakeMetaPackageInfoPlistFile(char* myPath, char* brand);

int main(int argc, char** argv) {
int retval = 0, err;
Expand Down Expand Up @@ -65,7 +66,9 @@ int main(int argc, char** argv) {
if (err) retval = err;
err = FixInfoPlistFile("./WaitPermissions-Info.plist");
if (err) retval = err;
err = MakeInstallerInfoPlistFile("./Pkg-Info.plist", "BOINC Manager");
err = MakeBOINCPackageInfoPlistFile("./Pkg-Info.plist", "BOINC Manager");
if (err) retval = err;
err = MakeMetaPackageInfoPlistFile("./Mpkg-Info.plist", "BOINC Manager");
return retval;
}

Expand Down Expand Up @@ -200,7 +203,7 @@ int FixInfoPlistFile(char* myPath) {
}


int MakeInstallerInfoPlistFile(char* myPath, char* brand) {
int MakeBOINCPackageInfoPlistFile(char* myPath, char* brand) {
int retval = 0;
FILE *f;

Expand All @@ -211,7 +214,7 @@ int MakeInstallerInfoPlistFile(char* myPath, char* brand) {
if (f)
{
fprintf(f, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(f, "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n");
fprintf(f, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n");
fprintf(f, "<plist version=\"1.0\">\n<dict>\n");
fprintf(f, "\t<key>CFBundleGetInfoString</key>\n");
fprintf(f, "\t<string>%s %s</string>\n", brand, BOINC_VERSION_STRING);
Expand Down Expand Up @@ -245,3 +248,56 @@ int MakeInstallerInfoPlistFile(char* myPath, char* brand) {
}


int MakeMetaPackageInfoPlistFile(char* myPath, char* brand) {
int retval = 0;
FILE *f;

if (IsFileCurrent(myPath))
return 0;

f = fopen(myPath, "w");
if (f)
{
fprintf(f, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(f, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n");
fprintf(f, "<plist version=\"1.0\">\n<dict>\n");
fprintf(f, "\t<key>CFBundleGetInfoString</key>\n");
fprintf(f, "\t<string>%s %s + VirtualBox</string>\n", brand, BOINC_VERSION_STRING);
fprintf(f, "\t<key>CFBundleIdentifier</key>\n\t<string>edu.berkeley.boinc+vbox</string>\n");
fprintf(f, "\t<key>CFBundleShortVersionString</key>\n");
fprintf(f, "\t<string>%s</string>\n", BOINC_VERSION_STRING);
fprintf(f, "\t<key>IFMajorVersion</key>\n\t<integer>%d</integer>\n", BOINC_MAJOR_VERSION);
fprintf(f, "\t<key>IFMinorVersion</key>\n\t<integer>%d</integer>\n", BOINC_MINOR_VERSION);
fprintf(f, "\t<key>IFPkgFlagAllowBackRev</key>\n\t<integer>1</integer>\n");
fprintf(f, "\t<key>IFPkgFlagAuthorizationAction</key>\n\t<string>RootAuthorization</string>\n");
fprintf(f, "\t<key>IFPkgFlagComponentDirectory</key>\n\t<string>../</string>\n");

fprintf(f, "\t<key>IFPkgFlagPackageList</key>\n");

fprintf(f, "\t<array>\n");
fprintf(f, "\t\t<dict>\n");
fprintf(f, "\t\t\t<key>IFPkgFlagPackageLocation</key>\n\t\t\t<string>BOINC.pkg</string>\n");
fprintf(f, "\t\t\t<key>IFPkgFlagPackageSelection</key>\n\t\t\t<string>required</string>\n");
fprintf(f, "\t\t</dict>\n");

fprintf(f, "\t\t<dict>\n");
fprintf(f, "\t\t\t<key>IFPkgFlagPackageLocation</key>\n\t\t\t<string>VirtualBox.pkg</string>\n");
fprintf(f, "\t\t\t<key>IFPkgFlagPackageSelection</key>\n\t\t\t<string>selected</string>\n");
fprintf(f, "\t\t</dict>\n");
fprintf(f, "\t</array>\n");

fprintf(f, "\t<key>IFPkgFormatVersion</key>\n\t<real>0.10000000149011612</real>\n");
fprintf(f, "</dict>\n</plist>\n");

fflush(f);
retval = fclose(f);
}
else {
puts("Error creating file Mpkg-Info.plist\n");
retval = -1;
}

return retval;
}


2 changes: 1 addition & 1 deletion mac_installer/Description.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IFPkgDescriptionDescription</key>
<string></string>
<string>Installs BOINC Manager, screensaver and data</string>
<key>IFPkgDescriptionTitle</key>
<string>BOINC Manager</string>
</dict>
Expand Down
15 changes: 11 additions & 4 deletions mac_installer/Installer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <sys/wait.h> // waitpid
#include <dirent.h>
#include <sys/param.h> // for MAXPATHLEN
#include <sys/stat.h>


#define boinc_master_user_name "boinc_master"
Expand All @@ -52,7 +53,7 @@ CFStringRef valueNoRestart = CFSTR("NoRestart");

int main(int argc, char *argv[])
{
char pkgPath[MAXPATHLEN], infoPlistPath[MAXPATHLEN];
char pkgPath[MAXPATHLEN], infoPlistPath[MAXPATHLEN], MetaPkgPath[MAXPATHLEN];
char brand[64], s[256];
char *p;
ProcessSerialNumber ourPSN, installerPSN;
Expand All @@ -70,6 +71,7 @@ int main(int argc, char *argv[])
CFStringRef currentValue = NULL, desiredValue = NULL;
CFStringRef errorString = NULL;
OSStatus err = noErr;
struct stat stat_buf;

Initialize();

Expand Down Expand Up @@ -99,6 +101,9 @@ int main(int argc, char *argv[])
if (p)
*p = '\0';

strlcpy(MetaPkgPath, pkgPath, sizeof(MetaPkgPath));
strlcat(MetaPkgPath, "+VirtualBox.mpkg", sizeof(MetaPkgPath));
strlcat(pkgPath, ".pkg", sizeof(pkgPath));
err = Gestalt(gestaltSystemVersion, &response);
if (err != noErr)
return err;
Expand All @@ -125,8 +130,6 @@ int main(int argc, char *argv[])
sprintf(s, "rm -rf \"/Library/Receipts/%s.pkg\"", brand);
system (s);

strlcat(pkgPath, ".pkg", sizeof(pkgPath));

err = Gestalt(gestaltSystemVersion, &response);
if (err != noErr)
return err;
Expand Down Expand Up @@ -191,7 +194,11 @@ int main(int argc, char *argv[])
CFRelease(propertyListRef);

if (err == noErr) {
sprintf(infoPlistPath, "open \"%s\" &", pkgPath);
if ((response < 0x1050) || stat(MetaPkgPath, &stat_buf)) { // stat() returns zero on success
sprintf(infoPlistPath, "open \"%s\" &", pkgPath);
} else {
sprintf(infoPlistPath, "open \"%s\" &", MetaPkgPath);
}
system(infoPlistPath);
}

Expand Down
29 changes: 27 additions & 2 deletions mac_installer/release_boinc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
## updated 11/26/11 by Charlie Fenton for new Default skin
## updated 11/27/11 by Charlie Fenton for new virtualbox directory
## updated 12/2/11 by Charlie Fenton to restore wrapper and reboot if needed
## updated 1/6/12 by Charlie Fenton to also install VirtualBox
##
## NOTE: This script uses PackageMaker, which is installed as part of the
## XCode developer tools. So you must have installed XCode Developer
Expand Down Expand Up @@ -119,7 +120,7 @@ sudo rm -dfR ../BOINC_Installer/Pkg_Root
mkdir -p ../BOINC_Installer/Installer\ Resources/
mkdir -p ../BOINC_Installer/Installer\ Scripts/

cp -fp mac_Installer/License.rtf ../BOINC_Installer/Installer\ Resources/
cp -fp mac_installer/License.rtf ../BOINC_Installer/Installer\ Resources/
cp -fp mac_installer/ReadMe.rtf ../BOINC_Installer/Installer\ Resources/
cp -fp win_build/installerv2/redist/all_projects_list.xml ../BOINC_Installer/Installer\ Resources/

Expand Down Expand Up @@ -241,13 +242,37 @@ fi
# Allow the installer wrapper application to modify the package's Info.plist file
sudo chmod a+rw ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC.pkg/Contents/Info.plist

# add a more complete Description.plist file to display in Installer's Customize pane
cp -fp mac_installer/Description.plist ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC.pkg/Contents/Resources/en.lproj/
if [ $? -ne 0 ]; then
# if no en.lproj directory then try English.lproj
cp -fp mac_installer/Description.plist ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC.pkg/Contents/Resources/English.lproj/
fi

# Build the BOINC+VirtualBox.mpkg metapackage if VirtualBox.pkg exists

VirtualBoxPackageName="VirtualBox.pkg"
if [ -d mac_installer/${VirtualBoxPackageName}/ ]; then
mkdir -p "../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC Installer.app/Contents/Resources/BOINC+VirtualBox.mpkg/Contents/Resources"
cp -fp mac_build/Mpkg-Info.plist ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC+VirtualBox.mpkg/Contents/Info.plist
cp -fp mac_installer/License.rtf ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC+VirtualBox.mpkg/Contents/Resources/
cp -fp ../BOINC_Installer/Installer\ Resources/ReadMe.rtf ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC+VirtualBox.mpkg/Contents/Resources/
cat >> ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC+VirtualBox.mpkg/Contents/Resources/package_version << ENDOFFILE
major: $1
minor: $2
ENDOFFILE
echo "pmkrpkg1" > ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/BOINC+VirtualBox.mpkg/Contents/PkgInfo

cp -fpR mac_installer/${VirtualBoxPackageName} ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/BOINC\ Installer.app/Contents/Resources/
fi

# Build the stand-alone client distribution
cp -fpR mac_build/Mac_SA_Insecure.sh ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/
cp -fpR mac_build/Mac_SA_Secure.sh ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/
cp -fpR COPYING ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/COPYING.txt
cp -fpR COPYING.LESSER ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/COPYING.LESSER.txt
cp -fpR COPYRIGHT ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/COPYRIGHT.txt
cp -fp mac_Installer/License.rtf ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/
cp -fp mac_installer/License.rtf ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/
sudo chown -R 501:admin ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/*
sudo chmod -R 644 ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/*

Expand Down

0 comments on commit 9502d33

Please sign in to comment.