Mac installer: optionally build combined BOINC+VirtualBox installer in addition to basic BOINC installer

This commit is contained in:
Charlie Fenton 2013-11-01 02:41:10 -07:00
parent 9d9ae3e4aa
commit 49c0bd1ab7
3 changed files with 184 additions and 6 deletions

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
<title>BOINC Manager + VirtualBox</title>
<readme file="ReadMe.rtf" mime-type="text/rtf"/>
<license file="License.rtf" mime-type="text/rtf"/>
<options customize="never" allow-external-scripts="yes" rootVolumeOnly="true" hostArchitectures="i386"/>
<installation-check script="checkPrerequisite()"/>
<script>
/* js:pkmk:start */
function checkPrerequisite()
{
try
{
test = system.sysctl('hw.machine');
system.log("Hardware architecture detected: " + test);
result = (test == 'i386' || test == 'x86_64');
} catch (e) { system.log(e); result = false; }
if (!result)
{
my.result.type = 'Fatal';
my.result.title = system.localizedString('UNSUPPORTED_HW_MACHINE_TLE');
my.result.message = system.localizedString('UNSUPPORTED_HW_MACHINE_MSG');
return result;
}
try
{
test = system.version['ProductVersion'];
system.log("OS version detected: " + test);
result = (system.compareVersions(test, '10.6') >= 0);
} catch (e) { system.log(e); result = false; }
if (!result)
{
my.result.type = 'Fatal';
my.result.title = system.localizedString('UNSUPPORTED_OS_TLE');
my.result.message = system.localizedString('UNSUPPORTED_OS_MSG');
return result;
}
try
{
/* Embedded scripts are not available here. So, just do a command
line checking for running VMs instead. */
rcScript = system.run('/bin/sh', '-c', '/bin/ps -e | /usr/bin/grep -E "VirtualBoxVM.*startvm|VBoxNetDHCP" | /usr/bin/grep -qv grep');
result = (rcScript != 0);
system.log("system.run /bin/sh .. returned: " + rcScript + " result=" + result);
} catch (e) { system.log(e); result = false; }
if (!result)
{
my.result.type = 'Fatal';
my.result.title = system.localizedString('RUNNING_VMS_TLE');
my.result.message = system.localizedString('RUNNING_VMS_MSG');
return result;
}
system.log("result:" + result);
return result;
}
/* js:pkmk:end */
</script>
<choices-outline>
<line choice="choiceBOINC"/>
<line choice="choiceVBoxKEXTs"/>
<line choice="choiceVBoxStartup"/>
<line choice="choiceVBox"/>
<line choice="choiceVBoxCLI"/>
</choices-outline>
<choice id="choiceBOINC" title="BOINC Manager" description="Installs BOINC Manager, screensaver and data" visible="false" selected="true" enabled="false">
<pkg-ref id="edu.berkeley.boinc" title="BOINC Manager Installer"/>
</choice>
<choice id="choiceVBoxKEXTs" title="choiceVBoxKEXTs_title" description="choiceVBoxKEXTs_msg" visible="false" selected="true" enabled="false">
<pkg-ref id="org.virtualbox.pkg.vboxkexts"/>
</choice>
<choice id="choiceVBoxStartup" title="choiceVBoxStartup_title" description="choiceVBoxStartup_msg" visible="false" selected="true" enabled="false">
<pkg-ref id="org.virtualbox.pkg.vboxstartupitems"/>
</choice>
<choice id="choiceVBox" title="choiceVBox_title" description="choiceVBox_msg" visible="false" selected="true" enabled="false">
<pkg-ref id="org.virtualbox.pkg.virtualbox"/>
</choice>
<choice id="choiceVBoxCLI" title="choiceVBoxCLI_title" description="choiceVBoxCLI_msg" visible="false" selected="true" enabled="false">
<pkg-ref id="org.virtualbox.pkg.virtualboxcli"/>
</choice>
<pkg-ref id="edu.berkeley.boinc" version="x.y.z" onConclusion="none" installKBytes="18352" auth="Root">#BOINC.pkg</pkg-ref>
<pkg-ref id="edu.berkeley.boinc">
<bundle-version>
<bundle CFBundleVersion="x.y.z" id="edu.berkeley.boinc" path="Applications/BOINCManager.app"/>
<bundle CFBundleVersion="x.y.z" id="edu.berkeley.boincsaver" path="Library/Screen Savers/BOINCSaver.saver"/>
<bundle CFBundleVersion="x.y.z" id="edu.berkeley.boinc.PostInstall" path="tmp/PostInstall.app"/>
</bundle-version>
</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.vboxkexts" auth="Root" version="4.2.16" installKBytes="900">#VBoxKEXTs.pkg</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.vboxstartupitems" auth="Root" version="4.2.16" installKBytes="12">#VBoxStartupItems.pkg</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.virtualbox" auth="Root" version="4.2.16" installKBytes="221657">#VirtualBox.pkg</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.virtualboxcli" auth="Root" version="4.2.16" installKBytes="4">#VirtualBoxCLI.pkg</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.vboxkexts">
<bundle-version>
<bundle CFBundleShortVersionString="4.2.16" CFBundleVersion="4.2.16" id="org.virtualbox.kext.VBoxNetAdp" path="VBoxNetAdp.kext"/>
<bundle CFBundleShortVersionString="4.2.16" CFBundleVersion="4.2.16" id="org.virtualbox.kext.VBoxDrv" path="VBoxDrv.kext"/>
<bundle CFBundleShortVersionString="4.2.16" CFBundleVersion="4.2.16" id="org.virtualbox.kext.VBoxNetFlt" path="VBoxNetFlt.kext"/>
<bundle CFBundleShortVersionString="4.2.16" CFBundleVersion="4.2.16" id="org.virtualbox.kext.VBoxUSB" path="VBoxUSB.kext"/>
</bundle-version>
</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.vboxstartupitems">
<bundle-version/>
</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.virtualbox">
<bundle-version>
<bundle CFBundleShortVersionString="4.2.16" CFBundleVersion="4.2.16" id="org.virtualbox.app.VirtualBox" path="VirtualBox.app"/>
</bundle-version>
</pkg-ref>
<pkg-ref id="org.virtualbox.pkg.virtualboxcli">
<bundle-version/>
</pkg-ref>
<product id="edu.berkeley.boinc" version="BOINC Manager x,y,z + VirtualBox 4.2.16"/>
</installer-gui-script>

View File

@ -21,5 +21,5 @@
<pkg-ref id="edu.berkeley.boinc" title="BOINC Manager Installer" description="Installs BOINC Manager, screensaver and data"/> <pkg-ref id="edu.berkeley.boinc" title="BOINC Manager Installer" description="Installs BOINC Manager, screensaver and data"/>
</choice> </choice>
<pkg-ref id="edu.berkeley.boinc" version="0" onConclusion="none" installKBytes="18352" auth="Root">#BOINC.pkg</pkg-ref> <pkg-ref id="edu.berkeley.boinc" version="0" onConclusion="none" installKBytes="18352" auth="Root">#BOINC.pkg</pkg-ref>
<product version="BOINC Manager x.y.z"/> <product id="edu.berkeley.boinc" version="BOINC Manager x.y.z"/>
</installer-gui-script> </installer-gui-script>

View File

@ -35,6 +35,7 @@
## updated 6/18/13 by Charlie Fenton for localizable uninstaller ## updated 6/18/13 by Charlie Fenton for localizable uninstaller
## updated 8/15/13 by Charlie Fenton to fix bug in localizable uninstaller ## updated 8/15/13 by Charlie Fenton to fix bug in localizable uninstaller
## updated 10/30/13 by Charlie Fenton to build a flat package ## updated 10/30/13 by Charlie Fenton to build a flat package
## updated 11/1/13 by Charlie Fenton build installers both with and without VBox
## ##
## NOTE: This script requires Mac OS 10.6 or later, and uses XCode developer ## NOTE: This script requires Mac OS 10.6 or later, and uses XCode developer
## tools. So you must have installed XCode Developer Tools on the Mac ## tools. So you must have installed XCode Developer Tools on the Mac
@ -44,6 +45,15 @@
## NOTE: To build the executables under Lion and XCode 4, select from XCode's ## NOTE: To build the executables under Lion and XCode 4, select from XCode's
## menu: "Product/Buildfor/Build for Archiving", NOT "Product/Archive" ## menu: "Product/Buildfor/Build for Archiving", NOT "Product/Archive"
## To have this script build the combined BOINC+VirtualBox installer:
## * Create a directory named "VirtualBox Installer" in the same
## directory which contains he root directory of the boinc tree.
## * Copy VirtualBox.pkg from the VirtualBox installer disk image (.dmg)
## into this "VirtualBox Installer" directory.
## * Copy VirtualBox_Uninstall.tool from the VirtualBox installer disk
## image (.dmg) into this "VirtualBox Installer" directory.
##
## Usage: ## Usage:
## ##
## If you wish to code sign the installer and uninstaller, create a file ## If you wish to code sign the installer and uninstaller, create a file
@ -126,6 +136,7 @@ sudo rm -dfR ../BOINC_Installer/Installer\ Scripts/
sudo rm -dfR ../BOINC_Installer/Pkg_Root sudo rm -dfR ../BOINC_Installer/Pkg_Root
sudo rm -dfR ../BOINC_Installer/locale sudo rm -dfR ../BOINC_Installer/locale
sudo rm -dfR ../BOINC_Installer/Installer\ templates sudo rm -dfR ../BOINC_Installer/Installer\ templates
sudo rm -dfR ../BOINC_Installer/expandedVBox
mkdir -p ../BOINC_Installer/Installer\ Resources/ mkdir -p ../BOINC_Installer/Installer\ Resources/
mkdir -p ../BOINC_Installer/Installer\ Scripts/ mkdir -p ../BOINC_Installer/Installer\ Scripts/
@ -247,6 +258,19 @@ sudo chmod -R u+r-w,g+r-w,o+r-w ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1
# Copy the installer wrapper application "BOINC Installer.app" # Copy the installer wrapper application "BOINC Installer.app"
cp -fpR $BUILDPATH/BOINC\ Installer.app ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/ cp -fpR $BUILDPATH/BOINC\ Installer.app ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch/
# Prepare to build the BOINC+VirtualBox installer if VirtualBox.pkg exists
VirtualBoxPackageName="VirtualBox.pkg"
if [ -f "../VirtualBox Installer/${VirtualBoxPackageName}" ]; then
# Make a copy of the BOINC installer app without the installer package
sudo cp -pfR "../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_$arch" "../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_${arch}_vbox"
# Copy the VirtualBox uninstall tool into the extras directory
sudo cp -pfR "../VirtualBox Installer/VirtualBox_Uninstall.tool" "../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_${arch}_vbox/extras/"
sudo chown -R root:admin "../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_${arch}_vbox/extras/VirtualBox_Uninstall.tool"
sudo chmod -R u+r-w,g+r-w,o+r-w "../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_${arch}_vbox/extras/VirtualBox_Uninstall.tool"
fi
# Build the installer package inside the wrapper application's bundle # Build the installer package inside the wrapper application's bundle
cd "../BOINC_Installer/Installer templates" cd "../BOINC_Installer/Installer templates"
@ -257,12 +281,37 @@ productbuild --quiet --resources "../Installer Resources/" --version "BOINC Mana
cd "${BOINCPath}" cd "${BOINCPath}"
# Build the BOINC+VirtualBox.mpkg metapackage if VirtualBox.pkg exists # Build the BOINC+VirtualBox installer if VirtualBox.pkg exists
if [ -f "../VirtualBox Installer/${VirtualBoxPackageName}" ]; then
cp -fpR "mac_installer/V+BDistribution" "../BOINC_Installer/Installer templates/V+BDistribution"
VirtualBoxPackageName="VirtualBox.pkg" mkdir -p "../BOINC_Installer/expandedVBox/"
###### if [ -d mac_installer/${VirtualBoxPackageName}/ ]; then
###### To be filled in later pkgutil --expand "../VirtualBox Installer/${VirtualBoxPackageName}" "../BOINC_Installer/expandedVBox/VBox.pkg"
###### fi
pkgutil --flatten "../BOINC_Installer/expandedVBox/VBox.pkg/VBoxKEXTs.pkg" "../BOINC_Installer/Installer templates/VBoxKEXTs.pkg"
pkgutil --flatten "../BOINC_Installer/expandedVBox/VBox.pkg/VBoxStartupItems.pkg" "../BOINC_Installer/Installer templates/VBoxStartupItems.pkg"
pkgutil --flatten "../BOINC_Installer/expandedVBox/VBox.pkg/VirtualBox.pkg" "../BOINC_Installer/Installer templates/VirtualBox.pkg"
pkgutil --flatten "../BOINC_Installer/expandedVBox/VBox.pkg/VirtualBoxCLI.pkg" "../BOINC_Installer/Installer templates/VirtualBoxCLI.pkg"
cp -fpR "../BOINC_Installer/expandedVBox/VBox.pkg/Resources/en.lproj" "../BOINC_Installer/Installer Resources"
sudo rm -dfR "../BOINC_Installer/expandedVBox"
cp -fp mac_installer/V+BDistribution "../BOINC_Installer/Installer templates"
# Update version number
sed -i "" s/"x.y.z"/"$1.$2.$3"/g "../BOINC_Installer/Installer templates/V+BDistribution"
cd "../BOINC_Installer/Installer templates"
productbuild --quiet --resources "../Installer Resources" --version "BOINC Manager 7.3.0 + VirtualBox 4.2.16" --distribution "./V+BDistribution" "../New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_${arch}_vbox/BOINC Installer.app/Contents/Resources/BOINC.pkg"
cd "${BOINCPath}"
fi
# Build the stand-alone client distribution # 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_Insecure.sh ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_$arch-apple-darwin/
@ -309,8 +358,19 @@ cd ../BOINC_Installer/New_Release_$1_$2_$3
ditto -ck --sequesterRsrc --keepParent boinc_$1.$2.$3_macOSX_$arch boinc_$1.$2.$3_macOSX_$arch.zip ditto -ck --sequesterRsrc --keepParent boinc_$1.$2.$3_macOSX_$arch boinc_$1.$2.$3_macOSX_$arch.zip
ditto -ck --sequesterRsrc --keepParent boinc_$1.$2.$3_$arch-apple-darwin boinc_$1.$2.$3_$arch-apple-darwin.zip ditto -ck --sequesterRsrc --keepParent boinc_$1.$2.$3_$arch-apple-darwin boinc_$1.$2.$3_$arch-apple-darwin.zip
ditto -ck --sequesterRsrc --keepParent boinc_$1.$2.$3_macOSX_SymbolTables boinc_$1.$2.$3_macOSX_SymbolTables.zip ditto -ck --sequesterRsrc --keepParent boinc_$1.$2.$3_macOSX_SymbolTables boinc_$1.$2.$3_macOSX_SymbolTables.zip
if [ -d boinc_$1.$2.$3_macOSX_${arch}_vbox ]; then
ditto -ck --sequesterRsrc --keepParent boinc_$1.$2.$3_macOSX_${arch}_vbox boinc_$1.$2.$3_macOSX_${arch}_vbox.zip
fi
#popd #popd
cd "${BOINCPath}" cd "${BOINCPath}"
if [ 1 -ne 1 ]; then
sudo rm -dfR ../BOINC_Installer/Installer\ Resources/
sudo rm -dfR ../BOINC_Installer/Installer\ Scripts/
sudo rm -dfR ../BOINC_Installer/Pkg_Root
sudo rm -dfR ../BOINC_Installer/locale
sudo rm -dfR ../BOINC_Installer/Installer\ templates
sudo rm -dfR ../BOINC_Installer/expandedVBox
fi
return 0 return 0