<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="2">
    <pkg-ref id="com.sophos.connect">
        <bundle-version>
            <bundle CFBundleShortVersionString="1.4.919" CFBundleVersion="1.4.919" id="com.sophos.connect.gui" path="Applications/Sophos Connect.app"/>
        </bundle-version>
    </pkg-ref>
    <options customize="never" hostArchitectures="x86_64,arm64"/>
    <title>Sophos Connect</title>
    <installation-check script="installation_check()"/>
    <license file="license.html"/>
    <choices-outline>
        <line choice="default">
            <line choice="com.sophos.connect"/>
        </line>
    </choices-outline>
    <choice id="default"/>
    <choice id="com.sophos.connect" visible="false">
        <pkg-ref id="com.sophos.connect"/>
    </choice>
    <pkg-ref id="com.sophos.connect" version="1.4.919" onConclusion="none" installKBytes="25470">#SCVPNFiles.pkg</pkg-ref>
    <script>

    function installation_check()
    {
        if (system.compareVersions(system.version.ProductVersion, '11.0') == -1)
        {
            my.result.title = system.localizedString('IC_OS_VER_FAILED_MSG');
            my.result.message = system.localizedString('IC_OS_VER_FAILED_DESC');
            my.result.type = 'Fatal';

            return false;
        }

        const appPath = "/Applications/Sophos Connect.app";
        const installingVersion = "1.4.919";

        if (!system.files.fileExistsAtPath(appPath)) {
            return true;
        }

        const bundle = system.files.bundleAtPath(appPath);
        if (!bundle) {
            return true;
        }

        const installedVersion = bundle['CFBundleShortVersionString'];
        if (!installedVersion) {
            return true;
        }

        const compareRetVal = system.compareVersions(installedVersion, installingVersion);
        if (compareRetVal &lt; 0) {
            return true;
        }

        if (compareRetVal == 0) {
            my.result.title = system.localizedString('IC_VER_ALREADY_INSTALLED_MSG');
            my.result.message = system.localizedString('IC_VER_ALREADY_INSTALLED_DESC');
        } else {
            my.result.title = system.localizedString('IC_DOWNGRADE_NOT_ALLOWED_MSG');
            my.result.message = system.localizedString('IC_DOWNGRADE_NOT_ALLOWED_DESC');
        }

        my.result.type = "Fatal";
        return false;
    }

    </script>
</installer-gui-script>