RE: Upgrading and not replacing in a distribution package on Tiger orLeopard
RE: Upgrading and not replacing in a distribution package on Tiger orLeopard
- Subject: RE: Upgrading and not replacing in a distribution package on Tiger orLeopard
- From: Adam Peck <email@hidden>
- Date: Fri, 27 Mar 2009 08:22:46 -0600
- Thread-topic: Upgrading and not replacing in a distribution package on Tiger orLeopard
I would not use > to compare versions. You should be using the built in version comparison command: system.compareVersions.
Also that code could be simplified to be:
if(system.files.fileExistsAtPath(path))
{
if((bundle = system.files.bundleAtBath(path)) && system.compareVersions(bundle.CFBundleShortVersionString, '1.32') < 0)
return false;
}
return true;
________________________________________
From: installer-dev-bounces+adampeck=email@hidden [mailto:installer-dev-bounces+adampeck=email@hidden] On Behalf Of Dymyr Winicki
Sent: Thursday, March 26, 2009 10:21 PM
To: email@hidden
Subject: Upgrading and not replacing in a distribution package on Tiger orLeopard
Theoretically Packages and Distributions can be made to upgrade and not just replace files however using PackageMaker from the gui I haven't yet been able to do this.
With Packages I have using Iceberg. I have had trouble using Iceberg with metapackages with large number of files in the - With a simple mockup it upgrades and doesn't downgrade except with Leopard where it just replaces the files anyway.
I have not seen any answer on the forum (either to my questions or to others) that have broached this - so I will post my answer in the hope it will help others.
Basically I had a modular system that could be added to in terms of content and reward games and these could be updated from time to time. In the example listed only the core module has been updated.
Product X = Core Module v1 + Content Module A and Games Module K
Product Y = Core Module v2 + Content Module B and Games Module L
So if you install Product Y after Product X then the installer will upgrade Core Module to v2 a nd copy the Content Modules and Game modules side by side.
I you install Product X after Product Y, what happens is that the Core Module is replaced from v2 to v1
So it seems the distribution replaces rather than upgrades. (In in gui for PackageMaker I have this problem with plain packages as well)
What I have done is implement an action to the distribution - I have had to manually do this at the distribution.dist level as the actions found in the PackageMaker gui are not sophicated enough.
I have basically added the following code to the script section and modified the choice.
function pm_choice1_selected() {
result = true;
if (!(system.files.fileExistsAtPath(my.target.mountpoint + '/Library/Receipts/btcc.pkg') == true)) {
result = true;
} else
result = result && !(system.files.bundleAtPath('/Library/Receipts/btcc.pkg').CFBundleShortVersionString > '1.32');
return result;
and the corresponding choice
<choice id="choice1" title="btcc" Location="/Applications" selected="pm_choice1_selected()" enabled="false" start_enabled="false" > <pkg-ref id="com.edalive.btcc.pkg"/>
</choice>
This will select if the same or an upgrade but in all cases will not enable to be changed. I also changed customLocation to the keyword Location which means you cannot change the location of the install.
If there is an easier way of doing this I would like to know.
_______________________________________________
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