• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Package Maker and Choices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Package Maker and Choices


  • Subject: Re: Package Maker and Choices
  • From: Iceberg-Dev <email@hidden>
  • Date: Mon, 7 Dec 2009 00:41:03 +0100


On Dec 6, 2009, at 10:30 PM, Matheus Boosle wrote:

Hello,

I'm currently running latest Snow Leopard and latest Package Maker available. I created a package to install a software that have two options:
Install
Uninstall


I want to set it up to everytime Install is checked, Uninstall will be unavailable and deselected. Also, everytime that Uninstall is checked, Install will be deselected and unavailable.
I'm not having success in setting it up in Package Maker. How should I set these options?

Even though it's definitely not made with PackageMaker, this might help you:


Basically, I set a Requirement on the 'install' package.

Then I set a dependency on the 'uninstall' package so that it is enabled and selected only if the 'install' package is enabled and selected.


<?xml version="1.0" encoding="UTF-8"?>
<installer-script authoringTool="Packages" authoringToolVersion="0.9.1" authoringToolBuild="2B6" minSpecVersion="1.0">
<options/>
<!--+==========================+
| Presentation |
+==========================+-->
<title>DISTRIBUTION_TITLE</title>
<!--+==========================+
| Installer |
+==========================+-->
<choices-outline>
<line choice="installer_choice_1"/>
<line choice="installer_choice_2"/>
</choices-outline>
<choice id="installer_choice_1" start_enabled="installer_choice_1_requirement(false,true)" start_selected="installer_choice_1_requirement(false,false)" title="install" description="">
<pkg-ref id="fr.whitebox.pkg.install"/>
</choice>
<choice id="installer_choice_2" start_enabled="installer_choice_2_enabled()" enabled="installer_choice_2_enabled()" start_selected="installer_choice_2_selected(true)" selected="installer_choice_2_selected(false)" title="uninstall" description="">
<pkg-ref id="fr.whitebox.pkg.uninstall"/>
</choice>
<!--+==========================+
| Package References |
+==========================+-->
<pkg-ref id="fr.whitebox.pkg.uninstall" version="1.0">file:./ Contents/Packages/uninstall.pkg</pkg-ref>
<pkg-ref id="fr.whitebox.pkg.install" version="1.0">file:./ Contents/Packages/install.pkg</pkg-ref>
<!--+==========================+
| JavaScript Scripts |
+==========================+-->
<script>


	const IC_DISK_TYPE_DESTINATION=0;
	const IC_DISK_TYPE_STARTUP_DISK=1;
	const IC_OS_DISTRIBUTION_TYPE_ANY=0;
	const IC_OS_DISTRIBUTION_TYPE_CLIENT=1;
	const IC_OS_DISTRIBUTION_TYPE_SERVER=2;

function IC_CheckOS (inDiskType,inMustBeInstalled,inMinimumVersion,inDistributionType)
{
var tOSVersion=undefined;

/* Check Minimum Version */

if (inDiskType==IC_DISK_TYPE_DESTINATION)
{
if (my.target.systemVersion!=undefined)
{
tOSVersion=my.target.systemVersion.ProductVersion;
}

/* Check if no OS is installed on the potential target */

if (tOSVersion==undefined)
{
return (inMustBeInstalled==false);
}
}
else
{
tOSVersion=system.version.ProductVersion;
}

if (system.compareVersions(tOSVersion,inMinimumVersion)==-1)
{
return false;
}

/* Check Distribution Type */

if (inDistributionType!=IC_OS_DISTRIBUTION_TYPE_ANY)
{
var tIsServer;

if (inDiskType==IC_DISK_TYPE_DESTINATION)
{
tIsServer=system.files.fileExistsAtPath(my.target.mountpoint+'/ System/Library/CoreServices/ServerVersion.plist');
}
else
{
tIsServer=system.files.fileExistsAtPath('/System/Library/ CoreServices/ServerVersion.plist');
}

if (inDistributionType==IC_OS_DISTRIBUTION_TYPE_CLIENT &amp;&amp; tIsServer==true)
{
return false;
}

if (inDistributionType==IC_OS_DISTRIBUTION_TYPE_SERVER &amp;&amp; tIsServer==false)
{
return false;
}
}

return true;
}


function installer_choice_1_requirement (inCheckVisibilityOnly,inShowFailedToolTip)
{
var tResult;


tResult=IC_CheckOS (IC_DISK_TYPE_DESTINATION,true,'10.4',IC_OS_DISTRIBUTION_TYPE_ANY);

		if (tResult==false)
		{
			if (inCheckVisibilityOnly==true)
			{
				tResult=true;
			}
		}

		return tResult;
	}

	function installer_choice_2_enabled()
	{
		return !choices.installer_choice_1.enabled;
	}

	function installer_choice_2_selected(isStart)
	{
		var tSelected;

		tSelected=!choices.installer_choice_1.selected;

		if (installer_choice_2_enabled()==false || isStart==true)
		{
			return tSelected;
		}

		return (tSelected &amp;&amp; my.choice.selected);
	}

	</script>
</installer-script>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Package Maker and Choices (From: Matheus Boosle <email@hidden>)

  • Prev by Date: Package Maker and Choices
  • Next by Date: Logging from a plugin
  • Previous by thread: Package Maker and Choices
  • Next by thread: Logging from a plugin
  • Index(es):
    • Date
    • Thread