site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com Thread-index: AclP/YYHrTNmVlcMQrCB4rrAxoZ5RwBGm4hg Thread-topic: How to skip the installation when install a lower version. (PackageMaker3.02) Hi there, I use Package Maker 3.02 to make a distribution package on Leopard. I set "Result of JavaScript" in the package's "Requirements" tab. In the script, I can run most JS like "var a = 'someValue'", "system.log()", "system.files.fileExistsAtPath()", "if...else...". But it seems that I cannot use objects like "my.target" and "my.choice". I print them into install.log, the result is "undefined". The "Script Repository" I set is like: function VersionCheck() { ...... } Do I need to add some XML style code so that I can use the "my" object? (such as <installer-gui-script minSpecVersion="1">) Is there some sample script suitable for PackageMaker3? Best Regards, Kevin Gu
-----Original Message----- From: Iceberg-Dev [mailto:dev.iceberg@gmail.com] Sent: 2008年11月27日 3:31 To: Gu, Kevin Cc: Installer-Dev mailing-list Subject: Re: How to skip the installation when install a lower version. (PackageMaker3.02)
On Nov 26, 2008, at 4:29 AM, Gu, Kevin wrote:
Hi all,
I know this might be a very simple question, but I tried and failed many times and have to write this mail.
What I want is very simple: 1. Installation runs when install an initial version or install a higher version. 2. Installation skips when install an lower version.
I have tried the "Package Version", but it doesn't work. I use PackageMaker 3.02 on Leopard.
Any help will be highly appreciated. Thanks in advance.
If you use a distribution script, it might be worth giving a look at the following target task:
my.target.receiptForIdentifier()
As far as I can tell, you can:
- get the version of your package installed on the target disk
var tInstalledPackageVersion;
tInstalledPackageVersion=my.target.receiptForIdentifier ('com.apple.MacOSX.lang.no'); /* Example */
system.log(tInstalledPackageVersion.version);
- get the version of a package in your distribution script using the choices > packages > version.
- finally you can compare both values with system.compareVersions
You will need to check that the different values exist or use try/catch,
My $0.02
_______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com