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>
Hi,
ReplyDeleteI want to use different background file depending on different version of OSX.
But I am not able to put the background tag in condition. Please let me know if there is a way of doing it.
Case:
1. For version 10.8 and below use picture.png
2. For version 10.9 and above ose picture1.png
With the attributes available for use in the Distribution file, I don't see a way of doing what you want. The background tag takes the file from the bundled resources. Now, your resources may have different localized folders which means you may be able to provide different file for different locale. But, I don't think it is possible to change the file based on OS.
DeleteI have a similar problem... I need to vary the background alignment depending on locale. On left-to-right languages I need to align the background to bottom-right, while alignment must be bottom-left for right-to-left languages (because the layout is different with the section list on the right-hand side).
DeleteI'm currently experimenting with JavaScript but document.write doesn't seem to be available in this context so it's starting to look like it's very difficult. How can I emit document content similarly to document.write in HTML?