<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="1">
    <title>Prey</title>
    <organization>com.prey</organization>
    <background file="mac-installer.png" mime-type="image/png" scaling="proportional" alignment="topleft"/>
    <domains enable_localSystem="true"/>
    <options customize="never" require-scripts="true" rootVolumeOnly="true"/>
    <options customize="never" hostArchitectures="x86_64,arm64" rootVolumeOnly="true"/>
    <options allow-external-scripts="yes"/>
    <installation-check script="installation_check()"/>
    <!-- Define documents displayed at various steps -->
    <!--<welcome    file="welcome.rtf" />-->
    <license file="license.txt"/>
    <!--<readme     file="README.html" />-->
    <conclusion file="conclusion.rtf"/>
    <!-- List all component packages -->
    <pkg-ref id="com.prey.agent" version="1.13.41" auth="root" installKBytes="193809">#com.prey.agent.pkg</pkg-ref>
    <!-- List them again here. They can now be organized as a hierarchy if you want. -->
    <choices-outline>
        <line choice="com.prey.agent"/>
    </choices-outline>
    <choice id="com.prey.agent" visible="false" title="The Prey Agent" description="The Prey Agent" start_selected="true">
        <pkg-ref id="com.prey.agent"/>
    </choice>
    <script>
const __IC_FLAT_DISTRIBUTION__=true;
const IC_COMPARATOR_IS_LESS=-1;
const IC_COMPARATOR_IS_EQUAL=0;
const IC_COMPARATOR_IS_GREATER=1;
const IC_COMPARATOR_IS_NOT_EQUAL=2;

function IC_CheckScriptReturnValue(inScriptPath,inArguments,inComparator,inReturnValue) {
  var tReturnValue;

  if (inScriptPath.charAt(0)=='/') {
    /* Check Absolute Path Existence */
    
    if (system.files.fileExistsAtPath(inScriptPath)==false) {
      return false;
    }
  } else {
    if (__IC_FLAT_DISTRIBUTION__==true &amp;&amp; system.compareVersions(system.version.ProductVersion, '10.6.0')&lt;0) {
      system.log("[WARNING] Embedded scripts are not supported in Flat distribution format on Mac OS X 10.5");
      return true;
    }
  }

  if (inArguments.length&gt;0) {
    var tMethodCall;
    var tStringArguments=[];
    
    for(var i=0;i&lt;inArguments.length;i++) {
      tStringArguments[i]='inArguments['+i+']';
    }
    
    tMethodCall='system.run(inScriptPath,'+tStringArguments.join(',')+');';
    tReturnValue=eval(tMethodCall);
  } else {
    tReturnValue=system.run(inScriptPath);
  }

  if (tReturnValue==undefined) {
    return false;
  }

  if (inComparator==IC_COMPARATOR_IS_EQUAL) {
    return (tReturnValue==inReturnValue);
  } else if (inComparator==IC_COMPARATOR_IS_GREATER) {
    return (tReturnValue&gt;inReturnValue);
  } else if (inComparator==IC_COMPARATOR_IS_LESS) {
    return (tReturnValue&lt;inReturnValue);
  } else if (inComparator==IC_COMPARATOR_IS_NOT_EQUAL) {
    return (tReturnValue!=inReturnValue);
  }

  return false;
}

function installation_check() {
  var tResult;
  var tScriptArguments0=new Array();

  // tResult=IC_CheckScriptReturnValue('check_if_api_key_present.sh',tScriptArguments0,IC_COMPARATOR_IS_EQUAL,0);
  tResult=IC_CheckScriptReturnValue('check_api_key_and_slots.sh',tScriptArguments0,IC_COMPARATOR_IS_EQUAL,0);

  if (tResult == false) {
    my.result.title = system.localizedString('REQUIREMENT_FAILED_MESSAGE_INSTALLATION_CHECK_1');
    my.result.message = system.localizedString('REQUIREMENT_FAILED_DESCRIPTION_INSTALLATION_CHECK_1');
    my.result.type = 'Fatal';
  }

  return tResult;
}
    </script>
    <pkg-ref id="com.prey.agent">
        <bundle-version>
            <bundle CFBundleShortVersionString="3.1" CFBundleVersion="2019101101" id="com.preypatchmojave" path="versions/1.13.41/lib/agent/utils/Prey.app"/>
        </bundle-version>
    </pkg-ref>
</installer-gui-script>