• 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
How to get the "cannot downgrade" warning message?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to get the "cannot downgrade" warning message?


  • Subject: How to get the "cannot downgrade" warning message?
  • From: Dirk Stegemann <email@hidden>
  • Date: Thu, 04 Oct 2012 15:30:41 +0200

Hello,

I am currently converting a non-flat installer package to a flat installer package, but I'm facing some problems regaring the prevention of downgrade installations: 

The old non-flat installer package would display a nice warning message to the user that says "<PackageName> can't be installed on this disk. A newer version of this software already exists on this disk." That screen's "Continue" button would be disabled.

The new flat installation package doesn't present any warning message, though: instead, it's simply stuck in the "Installation Type" screen, where it says "Click Install to perform a standard installation of this software on the disk <RootVolumeName>." The "Install" button is disabled.


So my question is:
How to configure a flat distribution package to display the "cannot downgrade" warning message to the user?



What I have achieved so far:
I have created a flat standard package using the "pkgbuild" tool, then I wrapped that standard package in a flat distribution package, using the "productbuild" tool and a customized distribution configuration file. 
I configured the distribution package to prevent downgrades by creating a "choice" which enables/disables the standard package, and setting the choice's "start_selected" attribute using a "choiceIsADowngrade()" _javascript_ (similar to this one: <http://code.google.com/p/openvanilla/source/browse/trunk/Distributions/OpenVanilla-Leopard-0.8/PackageMaker.app/Contents/Resources/choiceIsADowngrade.js?r=3281>).



Some more information:
The choice itself is neither customizable nor visible, and the _javascript_ mechanism to prevent downgrades works perfectly fine.
Also, the package is not relocatable, so the "Destination Select" screen is usually skipped. When a downgrade installation is detected for the old non-flat package, though, the above mentioned warning message is displayed within the (otherwise skipped) "Destination Select" screen. 

The packages are built on a Mac OS X 10.7.5 system, the described behaviour is the same on Mac OS X 10.6.8, 10.7.5 and 10.8.2. 




The distribution configuration file looks like this:

----- snip -----
<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="1">
    <title>MyPackage</title>
    <background alignment="topleft" file="background.png" scaling="none"/>
    <welcome file="Welcome.rtf"/>
    <readme file="ReadMe.rtf"/>
    <license file="License.rtf"/>
    <options rootVolumeOnly="true" allow-external-scripts="yes" customize="never"/>
    <pkg-ref id="my.installer.package"/>
    <pkg-ref id="my.installer.package" _onConclusion_="none">MyPackage.pkg</pkg-ref>
    <choice id="choice-id.MyPackage" start_visible="false" start_enabled="false" start_selected='!choiceIsADowngrade();' title="MyPackage">
        <pkg-ref id="my.installer.package"/>
    </choice>
    <choices-outline>
        <line choice="choice-id.MyPackage"/>
    </choices-outline>
    <installation-check script="pm_install_check();"/>
    
    <script>
        function pm_install_check() {
            try {
                var checkResult = system.run("InstallationCheck")
                
                // Check for system version.
                if (checkResult == 113) {
                    my.result.title = system.localizedString('Error');
                    my.result.message = system.localizedString('OperatingSystemTooOld');
                    my.result.type = 'Fatal';
                    return false;
                }
                
                // Check for architecture.
                if (checkResult == 114) {
                    my.result.title = system.localizedString('Error');
                    my.result.message = system.localizedString('IntelOnly');
                    my.result.type = 'Fatal';
                    return false;
                }
                
              } catch (e) {}
              
              return true;
            }
    </script>
    
    <script>
                function choiceIsADowngrade() {
                        return  checkChoiceUpgradeAction() 
                }
    </script>
    
    <script>
                function checkChoiceUpgradeAction() {
                        var result = false
                        try {
                                result = my.choice.packageUpgradeAction == 'downgrade' || my.choice.packageUpgradeAction == 'mixed'
                        } catch (e) {}
        
                        return result
                }
    </script>
</installer-gui-script>----- snip -----


 _______________________________________________
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

  • Prev by Date: Re: Drag n Drop Installer
  • Next by Date: Possible to install an IOKit driver without rebooting?
  • Previous by thread: Re: Drag n Drop Installer
  • Next by thread: Possible to install an IOKit driver without rebooting?
  • Index(es):
    • Date
    • Thread