<?xml version="1.0" encoding="windows-1252"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Fragment>

    <ComponentGroup Id="FragmentProperties" />
    <Property Id="MASTER_PORT" Value="." />
    <Property Id="SERVER_PORT" Value="." />

    <!-- Add/Remove Programs icon and help link -->
    <Property
      Id="ARPPRODUCTICON"
      Value="<%= settings[:company_id] %>.ico" />
    <Property
      Id="ARPHELPLINK"
      Value="<%= settings[:links][:HelpLink] %>" />

    <!-- Reinstallmode default to always replace files -->
    <!-- https://msdn.microsoft.com/en-us/library/aa371182%28v=vs.85%29.aspx -->
    <Property
      Id="REINSTALLMODE"
      Value="amus"/>

    <!-- This property is used in the localization strings for the GUI -->
    <Property
      Id="VersionUIString"
      Value="<%= @version.sub(/\.g[0-9a-z]{7}$/, '') %>" />

    <!--
      By default, install OpenVox agent to run as LocalSystem. Password
      is hidden to prevent it from appearing in msiexec log files
    -->
    <Property
      Id="PUPPET_AGENT_ACCOUNT_DOMAIN"
      Value="."/>
    <Property
      Id="PUPPET_AGENT_ACCOUNT_USER"
      Value="LocalSystem"/>
    <Property
      Id="PUPPET_AGENT_ACCOUNT_PASSWORD"
      Hidden="yes"/>

    <!-- To use WixUI_InstallDir, you must set a property named
       WIXUI_INSTALLDIR with a value of the ID of the directory you want the
       user to be able to specify the location of. -->
    <Property
      Id="WIXUI_INSTALLDIR"
      Value="INSTALLDIR" />
    <!-- This text is placed as a literal string in the GUI -->
    <Property
      Id="WIXUI_EXITDIALOGOPTIONALTEXT"
      Value="Manage your first resources on this node, explore the OpenVox community and get support using the shortcuts in the Documentation folder of your Start Menu." />

    <Property
      Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
      Value="Disable Windows path length limit (260 character MAX_PATH limitation, requires Windows 10 1607 or later)" />

    <!--                  ***NOTE***
        When originally moving to vanagon builds of puppet-agent (specifically for 1.6.0 and 1.6.1),
        we wrote several registry entries to the wrong place. We fixed the issue in 1.6.2, but in order
        to maintain upgrade stability we now need to read from both the correct and incorrect Key
        locations. The two properties below coupled with the double registry search in the remembered
        property sections below will achieve that by trying the incorrect location, then the correct
        location. Note that the last location to be searched (the *correct* one) will take precedence if
        both locations are available.
                                              Sean P. McDonald 8/30/16     -->
    <Property
      Id="REMEMBERED_PUPPETINSTALLER_ROOT_KEY"
      Value="SOFTWARE\<%= settings[:pl_company_name] %>\PuppetInstaller">
    </Property>
    <Property
      Id="REMEMBERED_PUPPET_ROOT_KEY"
      Value="SOFTWARE\<%= settings[:pl_company_name] %>\Puppet">
    </Property>

    <!--
      Remembered Property Pattern
      http://robmensching.com/blog/posts/2010/5/2/The-WiX-toolsets-Remember-Property-pattern
      -->
    <!-- Registry settings, remembered install dir is dependent on x86/64.
         Everything else stays with x86 so both installer types can see it
      -->
    <!-- Note the static default value of "puppet".  This will be overriden by
         the command line. -->
    <Property Id="PUPPET_MASTER_SERVER">
      <!-- Recall the property in repair, upgrade, and uninstall scenarios -->
      <RegistrySearch
        Id="RecallBadPuppetMasterServer"
        Root="HKLM"
        Key="[REMEMBERED_PUPPET_ROOT_KEY]"
        Name="RememberedPuppetMasterServer"
        Type="raw"
        Win64="no" />
      <RegistrySearch
        Id="RecallPuppetMasterServer"
        Root="HKLM"
        Key="[REMEMBERED_PUPPETINSTALLER_ROOT_KEY]"
        Name="RememberedPuppetMasterServer"
        Type="raw"
        Win64="no" />
    </Property>
    <Property Id="PUPPET_SERVER">
      <!-- Recall the property in repair, upgrade, and uninstall scenarios -->
      <RegistrySearch
        Id="RecallBadPuppetServer"
        Root="HKLM"
        Key="[REMEMBERED_PUPPET_ROOT_KEY]"
        Name="RememberedPuppetServer"
        Type="raw"
        Win64="no" />
      <RegistrySearch
        Id="RecallPuppetServer"
        Root="HKLM"
        Key="[REMEMBERED_PUPPETINSTALLER_ROOT_KEY]"
        Name="RememberedPuppetServer"
        Type="raw"
        Win64="no" />
    </Property>
    <Property Id="PUPPET_AGENT_ENVIRONMENT">
      <!-- Recall the property in repair, upgrade, and uninstall scenarios -->
      <RegistrySearch
        Id="RecallBadPuppetAgentEnvironment"
        Root="HKLM"
        Key="[REMEMBERED_PUPPET_ROOT_KEY]"
        Name="RememberedPuppetAgentEnvironment"
        Type="raw"
        Win64="no" />
      <RegistrySearch
        Id="RecallPuppetAgentEnvironment"
        Root="HKLM"
        Key="[REMEMBERED_PUPPETINSTALLER_ROOT_KEY]"
        Name="RememberedPuppetAgentEnvironment"
        Type="raw"
        Win64="no" />
    </Property>
    <Property Id="PUPPET_AGENT_CERTNAME">
      <!-- Recall the property in repair, upgrade, and uninstall scenarios -->
      <RegistrySearch
        Id="RecallBadPuppetAgentCertname"
        Root="HKLM"
        Key="[REMEMBERED_PUPPET_ROOT_KEY]"
        Name="RememberedPuppetAgentCertname"
        Type="raw"
        Win64="no" />
      <RegistrySearch
        Id="RecallPuppetAgentCertname"
        Root="HKLM"
        Key="[REMEMBERED_PUPPETINSTALLER_ROOT_KEY]"
        Name="RememberedPuppetAgentCertname"
        Type="raw"
        Win64="no" />
    </Property>
    <Property Id="PUPPET_CA_SERVER">
      <RegistrySearch
        Id="RecallBadPuppetCAServer"
        Root="HKLM"
        Key="[REMEMBERED_PUPPET_ROOT_KEY]"
        Name="RememberedPuppetCaServer"
        Type="raw"
        Win64="no" />
      <RegistrySearch
        Id="RecallPuppetCAServer"
        Root="HKLM"
        Key="[REMEMBERED_PUPPETINSTALLER_ROOT_KEY]"
        Name="RememberedPuppetCaServer"
        Type="raw"
        Win64="no" />
    </Property>
    <Property Id="PUPPET_AGENT_STARTUP_MODE">
      <RegistrySearch
        Id="RecallBadPuppetAgentStartupMode"
        Root="HKLM"
        Key="[REMEMBERED_PUPPET_ROOT_KEY]"
        Name="RememberedPuppetAgentStartupMode"
        Type="raw"
        Win64="no" />
      <RegistrySearch
        Id="RecallPuppetAgentStartupMode"
        Root="HKLM"
        Key="[REMEMBERED_PUPPETINSTALLER_ROOT_KEY]"
        Name="RememberedPuppetAgentStartupMode"
        Type="raw"
        Win64="no" />
    </Property>

    <Property Id="INSTALLDIR">
      <RegistrySearch
        Id="RecallInstallDir"
        Root="HKLM"
        Key="SOFTWARE\<%= settings[:pl_company_name] %>\<%= settings[:pl_product_id] %>"
        Name="<%= settings[:RememberedInstallDirRegKey] %>"
        Type="raw"
        Win64="<%= settings[:win64] %>" />
    </Property>

    <Property Id="INSTALLDIR_X86" >
      <RegistrySearch
        Id="RecallInstallDirx86"
        Root="HKLM"
        Key="SOFTWARE\<%= settings[:pl_company_name] %>\<%= settings[:pl_product_id] %>"
        Name="<%= settings[:RememberedInstallDirRegKey] %>"
        Type="raw"
        Win64="<%= settings[:win64] %>" />
    </Property>

    <!--
      Check if there is a pre-existing Hiera 3 format file in either:
        1. C:\ProgramData\PuppetLabs\code
        2. C:\ProgramData\PuppetLabs\puppet\etc
      If either file exists, then we need to block the installation of the new format
      Hiera 5 default files.
      This Programdata directory is fixed, so its not influenced by a change in
      INSTALLDIR, so we can use the util:search property instead of a custom action.
      These properties are used in appdatafiles.wxs.
    -->
    <Property Id="PUP_PREEXISTING_CODE_HIERA">
      <DirectorySearch Id="CheckCodeDir" Path="C:\ProgramData\PuppetLabs\code" Depth="0" AssignToProperty="yes">
        <FileSearch Id="CheckCodeHieraFile" Name="hiera.yaml" />
      </DirectorySearch>
    </Property>
    <Property Id="PUP_PREEXISTING_CONF_HIERA">
      <DirectorySearch Id="CheckConfDir" Path="C:\ProgramData\PuppetLabs\puppet\etc" Depth="0" AssignToProperty="yes">
        <FileSearch Id="CheckConfHieraFile" Name="hiera.yaml" />
      </DirectorySearch>
    </Property>

  </Fragment>
</Wix>
