<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="2">
    <title>FLT</title>
    <background file="DmgBackground.tif"/>
    <welcome file="Welcome.html"/>
    <readme file="ReadMe.html"/>
    <license file="License.txt"/>
    <options allow-external-scripts="true"/>
    <options require-scripts="false"/>
    <options customize="never"/>
    <options rootVolumeOnly="false"/>
    <installation-check script="installation_check();"/>
    <script><![CDATA[
        function v7_daemon_installed() {
            return system.files.fileExistsAtPath(
                '/Library/LaunchDaemons/uk.co.thefoundry.rlm.plist');
        }

        function v6_daemon_installed() {
            return system.files.fileExistsAtPath(
                '/Library/LaunchDaemons/uk.co.thefoundry.rlm');
        }

        function v5_daemon_installed() {
            return system.files.fileExistsAtPath(
                '/Library/LaunchDaemons/uk.co.thefoundry.lmgrd');
        }

        function flex_daemon_installed() {
            return system.files.fileExistsAtPath(
                '/Library/StartupItems/FoundryFLEXlmServer/FoundryFLEXlmServer') ||
                system.files.fileExistsAtPath(
                '/Library/LaunchDaemons/uk.co.thefoundry.lmgrd.plist');
        }

        // Determine if RLM can be installed based on previously installed
        // versions of flt
        function installation_check() {
            if (v6_daemon_installed()) {
                my.result.title = 'Previous Install';
                my.result.message = 'Currently installed files :\n/Library/LaunchDaemons/uk.co.thefoundry.rlm.plist\n/Library/LaunchDaemons/uk.co.thefoundry.lmgrd.plist\n\nThere appears to already be an installation of the Foundry Licensing Tools on this machine. You must uninstall it before continuing.\n\nPlease open a terminal and as Administrator run\n/Applications/TheFoundry/LicensingTools7.3/uninstall.sh';
                my.result.type = 'Fatal';
                return false;
            } else if (v5_daemon_installed()) {
                my.result.title = 'Previous Install';
                my.result.message = 'Currently installed files :\n/Library/LaunchDaemons/uk.co.thefoundry.lmgrd\n\nThere appears to already be an installation of the Foundry FLEXlm Tools on this machine. You must uninstall it before continuing.\n\nPlease run\n/Applications/TheFoundry/FLEXlmTools5.0/FFT Uninstaller';
                my.result.type = 'Fatal';
                return false;
            } else if (flex_daemon_installed()) {
                my.result.title = 'Previous Install';
                my.result.message = 'There appears to already be an installation of the Foundry FLEXlm Tools on this machine. You must uninstall it before continuing.\n\nPlease open a terminal from /Applications/Utilities and as root run\n/usr/local/foundry/FLEXlm/lmutil lmdown -c /usr/local/foundry/FLEXlm/foundry.lic\nThen remove the old server by typing the following commands\nrm -r /Library/StartupItems/FoundryFLEXlmServer\nrm /usr/local/foundry/FLEXlm/lmgrd'
                my.result.type = 'Fatal';
                return false;
            } else if (v7_daemon_installed()) {
                my.result.title = 'Previous Install';
                my.result.message = 'Currently installed files :\n/Library/LaunchDaemons/uk.co.thefoundry.rlm.plist\n/Library/LaunchDaemons/uk.co.thefoundry.lmgrd.plist\n\nThere appears to already be an installation of the Foundry Licensing Tools on this machine. You must uninstall it before continuing.\n\nPlease open a terminal and as Administrator run\n/Applications/TheFoundry/LicensingTools7.3/uninstall.sh'
                my.result.type = 'Fatal';
                return false;
            }

            // If we've got this far tradition dictates we return a warning...
            my.result.title = 'Server Install';
            my.result.message = 'The Foundry Licensing Tools are only for installation on the license server machine. It should not be installed on any of the client-side machines.';
            my.result.type = 'Warning';
            return false;
        }
        ]]></script>
    <choices-outline>
        <line choice="rlmChoice"/>
    </choices-outline>
    <choice id="rlmChoice" title="rlm" start_selected="true" start_enabled="true" start_visible="true">
        <pkg-ref id="com.foundry.flu.rlm"/>
    </choice>
    <pkg-ref id="com.foundry.flu.rlm" version="9.0.0-rc6" auth="Admin" onConclusion="None" installKBytes="3549">#flt-rlm.pkg</pkg-ref>
    <pkg-ref id="com.foundry.flu.rlm">
        <bundle-version/>
    </pkg-ref>
    <product id="com.foundry.flu" version="9.0.0-rc6"/>
</installer-gui-script>