Inside Packagemaker Distribution.dist file
So now, you must be familiar with component and distribution packages. This post will cover everything about the ‘Distribution’ file contained inside every distribution package.
This file has all the information about the behavior of the package (both visually and in terms of workflow).
You can mention the background, License, Read Me files along with Installation-Check and Volume-Check.
You can find the list of all the attributes which you can use inside Distribution file at DistributionDefinitionReference.
Below is an example of a valid distribution file: (Comments are provided inline)
-----------------------------------------------------------------------------------------------------------------------------------------------
Below is an example of a valid distribution file: (Comments are provided inline)
<?xml version="1.0" ?>
<installer-script authoringTool="" authoringToolBuild="" authoringToolVersion="" minSpecVersion="1.000000">
<title>My Distribution Package</title>
<options allow-external-scripts="no" customize="allow"/>
<domains enable_localSystem="true"/>
<installation-check script="CustomInstallationCheck();"/>
<script>
<!-- You can write your custom Javascript functions here. -->
function CheckIfLeopardOrHigher()
{
<!-- An example function to check if system version is 10.6 or higher -->
retVal = true;
SnowLeopardOrHigher = system.compareVersions(my.target.systemVersion.ProductVersion, '10.6');
system.log("10.6 or higher:" + SnowLeopardOrHigher);
if(SnowLeopardOrHigher < 0)
{
retVal = false;
}
return retVal;
}
function CustomInstallationCheck()
{
<!-- An example function to show a typical installation check function -->
if(!(system.compareVersions(system.version.ProductVersion, '10.5') >= 0))
{
<!-- Allow installation only on 10.5 or higher -->
my.result.title = system.localizedString('ERROR_SYSTEM_VERSION_TITLE');
my.result.message = system.localizedString('ERROR_SYSTEM_VERSION_MSG');
my.result.type = 'Fatal';
return false;
}
if(!(system.sysctl('hw.cputype') == '7'))
{
<!-- Allow installation only on Intel machines -->
my.result.title = system.localizedString('ERROR_HW_MACHINE_TITLE');
my.result.message = system.localizedString('ERROR_HW_MACHINE_MSG');
my.result.type = 'Fatal';
return false;
}
return true;
}
</script>
<background alignment="center" file="background" scaling="tofit"/>
<readme file="ReadMe"/>
<choices-outline>
<line choice="choice1"/>
<line choice="choice2"/>
<line choice="choice3"/>
</choices-outline>
<choice id="choice1" start_visible="false" title="Component 1">
<pkg-ref id="com.vikrams.comp1" />
</choice>
<choice id="choice2" start_visible="false" title="Component 2">
<pkg-ref id="com.vikrams.comp2" />
</choice>
<choice id="choice3" description="APPLICATION_DESCRIPTION_MSG" start_enabled="false" title="Component 3" visible="!CheckIfLeopardOrHigher()">
<!-- This choice will not be visible on 10.5. Also, it will be disabled by default. See the above line. -->
<pkg-ref id="com.vikrams.comp3" />
</choice>
<pkg-ref auth="Root" id="com.vikrams.comp1" installKBytes="102400" version="1.0.0">#Component1.pkg</pkg-ref>
<pkg-ref auth="Root" id="com.vikrams.comp2" installKBytes="234000" version="1.0.0">#Component2.pkg</pkg-ref>
<pkg-ref auth="Root" id="com.vikrams.comp3" installKBytes="540564" version="1.0.0">#Component3.pkg</pkg-ref>
</installer-script>
-----------------------------------------------------------------------------------------------------------------------------------------------
<installer-script authoringTool="" authoringToolBuild="" authoringToolVersion="" minSpecVersion="1.000000">
<title>My Distribution Package</title>
<options allow-external-scripts="no" customize="allow"/>
<domains enable_localSystem="true"/>
<installation-check script="CustomInstallationCheck();"/>
<script>
<!-- You can write your custom Javascript functions here. -->
function CheckIfLeopardOrHigher()
{
<!-- An example function to check if system version is 10.6 or higher -->
retVal = true;
SnowLeopardOrHigher = system.compareVersions(my.target.systemVersion.ProductVersion, '10.6');
system.log("10.6 or higher:" + SnowLeopardOrHigher);
if(SnowLeopardOrHigher < 0)
{
retVal = false;
}
return retVal;
}
function CustomInstallationCheck()
{
<!-- An example function to show a typical installation check function -->
if(!(system.compareVersions(system.version.ProductVersion, '10.5') >= 0))
{
<!-- Allow installation only on 10.5 or higher -->
my.result.title = system.localizedString('ERROR_SYSTEM_VERSION_TITLE');
my.result.message = system.localizedString('ERROR_SYSTEM_VERSION_MSG');
my.result.type = 'Fatal';
return false;
}
if(!(system.sysctl('hw.cputype') == '7'))
{
<!-- Allow installation only on Intel machines -->
my.result.title = system.localizedString('ERROR_HW_MACHINE_TITLE');
my.result.message = system.localizedString('ERROR_HW_MACHINE_MSG');
my.result.type = 'Fatal';
return false;
}
return true;
}
</script>
<background alignment="center" file="background" scaling="tofit"/>
<readme file="ReadMe"/>
<choices-outline>
<line choice="choice1"/>
<line choice="choice2"/>
<line choice="choice3"/>
</choices-outline>
<choice id="choice1" start_visible="false" title="Component 1">
<pkg-ref id="com.vikrams.comp1" />
</choice>
<choice id="choice2" start_visible="false" title="Component 2">
<pkg-ref id="com.vikrams.comp2" />
</choice>
<choice id="choice3" description="APPLICATION_DESCRIPTION_MSG" start_enabled="false" title="Component 3" visible="!CheckIfLeopardOrHigher()">
<!-- This choice will not be visible on 10.5. Also, it will be disabled by default. See the above line. -->
<pkg-ref id="com.vikrams.comp3" />
</choice>
<pkg-ref auth="Root" id="com.vikrams.comp1" installKBytes="102400" version="1.0.0">#Component1.pkg</pkg-ref>
<pkg-ref auth="Root" id="com.vikrams.comp2" installKBytes="234000" version="1.0.0">#Component2.pkg</pkg-ref>
<pkg-ref auth="Root" id="com.vikrams.comp3" installKBytes="540564" version="1.0.0">#Component3.pkg</pkg-ref>
</installer-script>