<?xml version="1.0" encoding="UTF-8"?>
<!--
  GuruRMM Agent - WiX 3 / wixl build source (Linux CI)
  Built with: wixl -D Version=0.6.21 [-D SITEKEY=<uuid>] -a x64
              -o gururmm-agent-base-0.6.21.msi gururmm-agent-linux.wxs
  Companion to gururmm-agent.wxs (WiX 4, Windows native).
  install-report CA omitted: wixl lacks WixQuietExec64.
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product
      Name="GuruRMM Agent"
      Manufacturer="Arizona Computer Guru LLC"
      Id="*"
      Version="$(var.Version)"
      UpgradeCode="{41E29F1C-52BE-424B-B570-EF3ED2588794}"
      Language="1033">

    <Package
        InstallerVersion="500"
        Compressed="yes"
        InstallScope="perMachine"
        Description="GuruRMM Agent - Remote Monitoring and Management"
        Manufacturer="Arizona Computer Guru LLC" />

    <Media Id="1" Cabinet="agent.cab" EmbedCab="yes" />

    <Condition Message="This application requires a 64-bit version of Windows.">
      <![CDATA[VersionNT64]]>
    </Condition>

    <Upgrade Id="{41E29F1C-52BE-424B-B570-EF3ED2588794}">
      <UpgradeVersion
          Minimum="0.0.0"
          Maximum="$(var.Version)"
          IncludeMinimum="yes"
          IncludeMaximum="no"
          Property="OLDERVERSIONSBEINGUPGRADED" />
    </Upgrade>
    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallInitialize" />
    </InstallExecuteSequence>

    <?ifdef SITEKEY ?>
    <Property Id="SITEKEY" Value="$(var.SITEKEY)" />
    <?else ?>
    <Property Id="SITEKEY" Value="" />
    <?endif ?>
    <Property Id="AGENT_VERSION" Value="$(var.Version)" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles64Folder" Name="PFiles64">
        <Directory Id="INSTALLFOLDER" Name="GuruRMM">
          <Directory Id="LHM_DIR" Name="lhm" />
        </Directory>
      </Directory>
      <Directory Id="CommonAppDataFolder" Name="CommonAppData">
        <Directory Id="GURURMM_PROGRAMDATA" Name="GuruRMM" />
      </Directory>
    </Directory>

    <Feature Id="MainFeature" Title="GuruRMM Agent" Level="1">
      <ComponentRef Id="AgentBinary" />
      <ComponentRef Id="ProgramDataDir" />
      <ComponentRef Id="InstallReportScript" />
      <ComponentRef Id="LhmExe" />
      <ComponentRef Id="LhmExeConfig" />
      <ComponentRef Id="LhmLib" />
      <ComponentRef Id="LhmHidSharp" />
      <ComponentRef Id="LhmAgaControls" />
      <ComponentRef Id="LhmJson" />
      <ComponentRef Id="LhmOxyPlot" />
      <ComponentRef Id="LhmOxyPlotWinForms" />
      <ComponentRef Id="LhmTaskScheduler" />
      <ComponentRef Id="LhmCodeDom" />
    </Feature>

    <DirectoryRef Id="INSTALLFOLDER">
      <Component Id="AgentBinary" Guid="{1A2B3C4D-5E6F-4A7B-8C9D-0E1F2A3B4C5D}" Win64="yes">
        <File Id="GuruRMMAgentExe" Name="gururmm-agent.exe"
              Source="..\agent\target\release\gururmm-agent.exe" KeyPath="yes" />
        <File Id="GuruRMMTrayExe" Name="gururmm-tray.exe"
              Source="..\tray\target\release\gururmm-tray.exe" />
        <ServiceInstall
            Id="GuruRMMService"
            Name="GuruRMMAgent"
            DisplayName="GuruRMM Agent"
            Description="GuruRMM Agent - Remote Monitoring and Management service"
            Start="auto"
            Type="ownProcess"
            ErrorControl="normal"
            Arguments="service" />
        <ServiceControl
            Id="GuruRMMServiceControl"
            Name="GuruRMMAgent"
            Start="install"
            Stop="both"
            Remove="uninstall"
            Wait="no" />
      </Component>
    </DirectoryRef>

    <DirectoryRef Id="GURURMM_PROGRAMDATA">
      <Component Id="ProgramDataDir" Guid="{7B4AE52C-1D8F-4C3A-9E0C-2E1F5B8A4D91}" Win64="yes">
        <CreateFolder />
        <RegistryValue Root="HKLM" Key="SOFTWARE\GuruRMM" Name="InstallDir"
                       Type="string" Value="[INSTALLFOLDER]" KeyPath="yes" />
        <RegistryValue Root="HKLM" Key="SOFTWARE\GuruRMM" Name="SiteId"
                       Type="string" Value="[SITEKEY]" />
        <RegistryValue Root="HKLM" Key="SOFTWARE\GuruRMM" Name="Version"
                       Type="string" Value="[AGENT_VERSION]" />
      </Component>
      <Component Id="InstallReportScript" Guid="{3FA82C1D-60B4-4E9A-8C2F-7D5E1B9A3C04}" Win64="yes">
        <File Id="InstallReportPs1" Name="install-report.ps1"
              Source="install-report.ps1" KeyPath="yes" />
      </Component>
    </DirectoryRef>

    <DirectoryRef Id="LHM_DIR">
      <Component Id="LhmExe" Guid="{C3D4E5F6-A7B8-49C0-D1E2-F3A4B5C6D7E8}" Win64="yes">
        <File Id="LibreHardwareMonitorExe" Name="LibreHardwareMonitor.exe"
              Source="..\lhm\LibreHardwareMonitor.exe" KeyPath="yes" />
      </Component>
      <Component Id="LhmExeConfig" Guid="{D4E5F6A7-B8C9-4AD1-E2F3-A4B5C6D7E8F9}" Win64="yes">
        <File Id="LibreHardwareMonitorConfig" Name="LibreHardwareMonitor.exe.config"
              Source="..\lhm\LibreHardwareMonitor.exe.config" KeyPath="yes" />
      </Component>
      <Component Id="LhmLib" Guid="{E5F6A7B8-C9DA-4BE2-F3A4-B5C6D7E8F9A0}" Win64="yes">
        <File Id="LibreHardwareMonitorLibDll" Name="LibreHardwareMonitorLib.dll"
              Source="..\lhm\LibreHardwareMonitorLib.dll" KeyPath="yes" />
      </Component>
      <Component Id="LhmHidSharp" Guid="{F6A7B8C9-DAEB-4CF3-A4B5-C6D7E8F9A0B1}" Win64="yes">
        <File Id="HidSharpDll" Name="HidSharp.dll"
              Source="..\lhm\HidSharp.dll" KeyPath="yes" />
      </Component>
      <Component Id="LhmAgaControls" Guid="{A7B8C9DA-EBF0-4D04-B5C6-D7E8F9A0B1C2}" Win64="yes">
        <File Id="AgaControlsDll" Name="Aga.Controls.dll"
              Source="..\lhm\Aga.Controls.dll" KeyPath="yes" />
      </Component>
      <Component Id="LhmJson" Guid="{B8C9DAEB-F001-4E15-C6D7-E8F9A0B1C2D3}" Win64="yes">
        <File Id="NewtonsoftJsonDll" Name="Newtonsoft.Json.dll"
              Source="..\lhm\Newtonsoft.Json.dll" KeyPath="yes" />
      </Component>
      <Component Id="LhmOxyPlot" Guid="{C9DAEBF0-1122-4F26-D7E8-F9A0B1C2D3E4}" Win64="yes">
        <File Id="OxyPlotDll" Name="OxyPlot.dll"
              Source="..\lhm\OxyPlot.dll" KeyPath="yes" />
      </Component>
      <Component Id="LhmOxyPlotWinForms" Guid="{DAEBF001-2233-4037-E8F9-A0B1C2D3E4F5}" Win64="yes">
        <File Id="OxyPlotWindowsFormsDll" Name="OxyPlot.WindowsForms.dll"
              Source="..\lhm\OxyPlot.WindowsForms.dll" KeyPath="yes" />
      </Component>
      <Component Id="LhmTaskScheduler" Guid="{EBF00112-3344-4148-F9A0-B1C2D3E4F5A6}" Win64="yes">
        <File Id="TaskSchedulerDll" Name="Microsoft.Win32.TaskScheduler.dll"
              Source="..\lhm\Microsoft.Win32.TaskScheduler.dll" KeyPath="yes" />
      </Component>
      <Component Id="LhmCodeDom" Guid="{FCB01223-4455-4259-0AB1-C2D3E4F5A6B7}" Win64="yes">
        <File Id="SystemCodeDomDll" Name="System.CodeDom.dll"
              Source="..\lhm\System.CodeDom.dll" KeyPath="yes" />
      </Component>
    </DirectoryRef>

  </Product>
</Wix>
