<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
    <title>AnyConnect Secure Mobility Client</title>
    <background file="pkg_background.png" scaling="proportional" alignment="bottomleft"/>
    <license file="License.rtf"/>
    <options customize="never" rootVolumeOnly="true" hostArchitectures="x86_64"/>
    <choices-outline>
        <line choice="choice_vpn"/>
    </choices-outline>
    <choice id="choice_vpn" visible="true" title="VPN" description="Installs the module that enables VPN capabilities.">
        <pkg-ref id="com.cisco.pkg.anyconnect.vpn"/>
    </choice>
    <pkg-ref id="com.cisco.pkg.anyconnect.vpn" version="4.9.04043" installKBytes="37001">#vpn_module.pkg</pkg-ref>
    <installation-check script="InstallationCheck()"/>
    <volume-check script="VolumeCheck()"/>
    <script>
    function InstallationCheck()
    {
        if(!(system.compareVersions(system.version.ProductVersion, '10.9') &gt;= 0))
        {
            my.result.title = 'Cisco AnyConnect Secure Mobility Client';
            my.result.message = 'This software requires Mac OS X version 10.9 or later.';
            my.result.type = 'Fatal';
            return false;
        }
 
        return true;
    }
    
    function VolumeCheck()
    {
        // version of VPN being installed has to be higher than the version already installed

        var vpnReceipt = my.target.receiptForIdentifier("com.cisco.pkg.anyconnect.vpn");
        var vpnPackage = choices.choice_vpn.packages[0];

        // if the receipt is not there assume no VPN installed or pre-3.1.1 version so it is OK to install
        if (vpnReceipt)
        {
            // there is a 3.1.1+ version of VPN already installed
            // check to see if version in this package is newer
            var comparison = system.compareVersions(vpnReceipt.version, vpnPackage.version);

            if (comparison == 0)
            {
                // versions are the same
                my.result.message = 'Version ' + vpnReceipt.version + ' of the Cisco AnyConnect Secure Mobility Client is already installed.';
                my.result.type = 'Fatal';
                return false;
            }
            else if (comparison &gt; 0)
            {
                // installed version is newer
                my.result.message = 'Newer version ' + vpnReceipt.version + ' of the Cisco AnyConnect Secure Mobility Client is already installed.';
                my.result.type = 'Fatal';
                return false;
            }
        }

        // Check if standalone NVM is installed

        var nvmStandaloneReceipt = my.target.receiptForIdentifier("com.cisco.pkg.anyconnect.nvmstandalone");
        if(nvmStandaloneReceipt)
        {
            // if version of standalone NVM installed is greater than AC package version, fail with an error message
            var comparison = system.compareVersions(nvmStandaloneReceipt.version, vpnPackage.version);

            if (comparison &gt; 0)
            {
                my.result.message = 'Version ' + nvmStandaloneReceipt.version + ' of the Cisco AnyConnect Standalone Network Visibility Module is already installed.';
                my.result.type = 'Fatal';
                return false;
            }
        }

        return true;
    }
    </script>
    <pkg-ref id="com.cisco.pkg.anyconnect.vpn">
        <bundle-version>
            <bundle CFBundleShortVersionString="4.9.04043" CFBundleVersion="4.9.04043" id="com.cisco.anyconnect.gui" path="Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app"/>
            <bundle CFBundleShortVersionString="4.9.04043" CFBundleVersion="4.9.04043" id="com.cisco.anyconnect.uninstaller" path="Applications/Cisco/Uninstall AnyConnect.app"/>
            <bundle CFBundleVersion="4.9.04043" id="com.cisco.anyconnect.vpndownloader" path="opt/cisco/anyconnect/bin/vpndownloader.app"/>
            <bundle CFBundleShortVersionString="4.9.04043" CFBundleVersion="4.9.04043" id="com.cisco.anyconnect.macos.acsock" path="Applications/Cisco/Cisco AnyConnect Socket Filter.app"/>
            <bundle CFBundleShortVersionString="4.9.04043" CFBundleVersion="4.9.04043" id="com.cisco.anyconnect.notification" path="opt/cisco/anyconnect/bin/Cisco AnyConnect Secure Mobility Client Notification.app"/>
        </bundle-version>
    </pkg-ref>
</installer-gui-script>