Don't get path from registry until we fix proc.run

This commit is contained in:
Twangboy 2023-02-16 19:09:22 -07:00 committed by Pedro Algarvio
parent 035b640347
commit 1d6558afde
2 changed files with 145 additions and 156 deletions

View file

@ -194,17 +194,24 @@ class SaltPkgInstall:
def update_process_path(self):
# The installer updates the path for the system, but that doesn't
# make it to this python session, so we need to update that
if HAS_WINREG:
log.debug("Adding %s to the path", self.install_dir)
# Get the updated system path from the registry
path_key = winreg.OpenKeyEx(
winreg.HKEY_LOCAL_MACHINE,
r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment",
)
current_path = winreg.QueryValueEx(path_key, "path")[0]
path_key.Close()
# Update the path for the current running process
os.environ["PATH"] = current_path
os.environ["PATH"] = ";".join([str(self.install_dir), os.getenv("path")])
# When the MSI installer is run from self.proc.run, it doesn't update
# the registry. When run from a normal command prompt it does. Until we
# figure that out, we will update the process path as above. This
# doesn't really check that the path is being set though... but I see
# no other way around this
# if HAS_WINREG:
# log.debug("Refreshing the path")
# # Get the updated system path from the registry
# path_key = winreg.OpenKeyEx(
# winreg.HKEY_LOCAL_MACHINE,
# r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment",
# )
# current_path = winreg.QueryValueEx(path_key, "path")[0]
# path_key.Close()
# # Update the path for the current running process
# os.environ["PATH"] = current_path
def get_version(self, version_only=False):
"""
@ -844,6 +851,10 @@ class SaltPkgInstall:
shutil.rmtree(self.install_dir, ignore_errors=True)
# Remove registry entries
# This only removes the Add/Remove programs entry from the
# registry. There are a lot of remnants of Salt still in the
# registry... thousands. This will be the case until we figure
# out why we can't uninstall the MSI using self.proc.run
if HAS_WINREG:
log.debug("Removing registry entries")
key = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5693F9A3-3083-426B-B17B-B860C00C9B84}"

View file

@ -11,17 +11,15 @@ DECAC - Deferred Custom Action - It is run by the msiserver service, local syste
Sandboxed
IMCAC - Immediate Custom Action - It's immediate
Runs as Administrator
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product
Manufacturer = "$(var.MANUFACTURER)"
Name = "$(var.PRODUCT) $(var.DisplayVersion)"
Version = "$(var.InternalVersion)"
UpgradeCode = "FC6FB3A2-65DE-41A9-AD91-D10A402BD641"
Id = "*"
Language = "1033">
Manufacturer = "$(var.MANUFACTURER)"
Name = "$(var.PRODUCT) $(var.DisplayVersion)"
Version = "$(var.InternalVersion)"
UpgradeCode = "FC6FB3A2-65DE-41A9-AD91-D10A402BD641"
Id = "*"
Language = "1033">
<!-- Install per Machine -->
<Package
@ -31,6 +29,8 @@ IMCAC - Immediate Custom Action - It's immediate
InstallPrivileges = "elevated"
/>
<!-- Do not create cab files -->
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<!-- Abort installation if conditions are met -->
<?if $(var.WIN64)="no" ?>
@ -39,9 +39,9 @@ IMCAC - Immediate Custom Action - It's immediate
<Condition Message="[AbortReason]">Installed or (not AbortReason)</Condition>
<Condition Message="Installation requires Windows 7/Server 2012. Found MsiNTProductType [MsiNTProductType], VersionNT [VersionNT]">
Installed
OR (MsiNTProductType = 1) AND (VersionNT >= 601)
OR (MsiNTProductType = 2) AND (VersionNT >= 602)
OR (MsiNTProductType = 3) AND (VersionNT >= 602)
OR (MsiNTProductType = 1) AND (VersionNT >= 601)
OR (MsiNTProductType = 2) AND (VersionNT >= 602)
OR (MsiNTProductType = 3) AND (VersionNT >= 602)
</Condition>
<Condition Message="Installation requires 125 MB RAM. Found [PhysicalMemory] MB">Installed OR (PhysicalMemory > 125)</Condition>
<!--
@ -89,16 +89,16 @@ IMCAC - Immediate Custom Action - It's immediate
<!-- Search registry for previous msi and Nullsoft install dirs -->
<Property Id="REGISTRY_ROOTDIR">
<!-- New layout is C:\ProgramData\Salt Project\Salt -->
<?if $(var.WIN64)=yes ?>
<RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" Name="root_dir" Win64="yes" Type="raw" Id="p1" />
<?endif ?>
<?if $(var.WIN64)=yes ?>
<RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" Name="root_dir" Win64="yes" Type="raw" Id="p1" />
<?endif ?>
<RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" Name="root_dir" Win64="no" Type="raw" Id="p2" />
</Property>
<!-- Search registry for option to remove config uninstall, set in previous install -->
<Property Id="REMOVE_CONFIG">
<?if $(var.WIN64)=yes ?>
<RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" Name="REMOVE_CONFIG" Win64="yes" Type="raw" Id="p3" />
<?endif ?>
<?if $(var.WIN64)=yes ?>
<RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" Name="REMOVE_CONFIG" Win64="yes" Type="raw" Id="p3" />
<?endif ?>
<RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" Name="REMOVE_CONFIG" Win64="no" Type="raw" Id="p4" />
</Property>
@ -116,7 +116,6 @@ IMCAC - Immediate Custom Action - It's immediate
</RegistryKey>
</Component>
<!-- Search registry for NSIS install -->
<Property Id="NSIS_UNINSTALLSTRING">
<RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Salt Minion" Name="UninstallString" Type="raw" Win64="no" Id="n1" />
@ -126,18 +125,16 @@ IMCAC - Immediate Custom Action - It's immediate
<!-- Detect NSIS install -->
<SetProperty Id="nsis_install_found" Before="LaunchConditions" Value="1">NSIS_UNINSTALLSTRING >> "uninst.exe"</SetProperty>
<!--
Workaround.
We stop the salt-minion service before validating the installation.
Part of validation is checking the log file. If the log file is locked, the check can fail and the install can fail.
Something has a lock on the minion log file, either salt-minion or
ssm.exe
We stop the salt-minion service before validating the installation. Part of
validation is checking the log file. If the log file is locked, the check can
fail and the install can fail. Something has a lock on the minion log file,
either salt-minion or ssm.exe
Message is:
Another application has exclusive access to the file \salt\var\log\salt\minion
Please shut down the application
-->
<CustomAction Id="stopSalt" Script="vbscript">
On error resume next
@ -149,71 +146,66 @@ IMCAC - Immediate Custom Action - It's immediate
-->
<Binary Id="MinionConfigExt" SourceFile="CustomAction01\CustomAction01.CA.dll" />
<!-- The GUI Sequence (ask for input from the user) -->
<!--
You should not apply changes, only retrieve config.
Normally runs non-privileged, but reading salt config requires admin privilege.
https://docs.microsoft.com/en-us/windows/win32/msi/suggested-installuisequence
If this sequence is left out, this is a "silent install".
-->
The GUI Sequence (ask for input from the user)
You should not apply changes, only retrieve config. Normally runs
non-privileged, but reading salt config requires admin privilege.
https://docs.microsoft.com/en-us/windows/win32/msi/suggested-installuisequence
If this sequence is left out, this is a "silent install".
-->
<InstallUISequence>
<Custom Action="ReadConfig_IMCAC" Before="LaunchConditions">NOT Installed</Custom>
<LaunchConditions After="AppSearch" /> <!-- Benefit unclear. -->
</InstallUISequence>
<!-- The Install Sequence (aka server side) -->
<!--
Run with localsystem privilege.
The Install Sequence (aka server side)
Run with localsystem privilege.
https://docs.microsoft.com/en-us/windows/win32/msi/suggested-installexecutesequence
If the UI sequence took place, some (non-UI) actions are repeated (e.g. CostInitialize).
https://docs.microsoft.com/en-us/windows/win32/msi/suggested-installexecutesequence
If the UI sequence took place, some (non-UI) actions are repeated (e.g. CostInitialize).
Actions before MigrateFeatureStates:
Custom action is placed before the transaction starts, coined "immediate".
You should not modifiy the system.
Actions after InstallFiles:
Custom action is placed after the transaction started, coined "deferred" and run in a sandbox.
Deferred custom actions (DECAC) need custom action helper (CADH) to access msi properties
You may modify the system.
-->
Actions before MigrateFeatureStates:
Custom action is placed before the transaction starts, coined "immediate".
You should not modifiy the system.
Actions after InstallFiles:
Custom action is placed after the transaction started, coined "deferred" and run in a sandbox.
Deferred custom actions (DECAC) need custom action helper (CADH) to access msi properties
You may modify the system.
-->
<InstallExecuteSequence>
<!--
On install and uninstall:
stopSalt to release log file, installValidate requires access to all
files, including the log file
-->
<Custom Action="stopSalt" Before="InstallValidate" >1</Custom>
<Custom Action="stopSalt" Before="InstallValidate" >1</Custom>
<!-- ReadConfig_IMCAC must be called before CostInitialize so features can depend on properties set-->
<Custom Action="ReadConfig_IMCAC" Before="CostInitialize" >NOT Installed</Custom>
<Custom Action="del_NSIS_DECAC" After="InstallInitialize" >nsis_install_found</Custom>
<Custom Action="ReadConfig_IMCAC" Before="CostInitialize" >NOT Installed</Custom>
<Custom Action="del_NSIS_DECAC" After="InstallInitialize" >nsis_install_found</Custom>
<!-- If CLEAN_INSTALL, on install or upgrade: delete config and cache -->
<Custom Action="DeleteConfig2_CADH"
Before="DeleteConfig2_DECAC" >CLEAN_INSTALL and ((NOT Installed) or WIX_UPGRADE_DETECTED)</Custom>
<Custom Action="DeleteConfig2_DECAC" After="InstallInitialize" >CLEAN_INSTALL and ((NOT Installed) or WIX_UPGRADE_DETECTED)</Custom>
<Custom Action="DeleteConfig2_CADH" Before="DeleteConfig2_DECAC" >CLEAN_INSTALL and ((NOT Installed) or WIX_UPGRADE_DETECTED)</Custom>
<Custom Action="DeleteConfig2_DECAC" After="InstallInitialize" >CLEAN_INSTALL and ((NOT Installed) or WIX_UPGRADE_DETECTED)</Custom>
<Custom Action="MoveInsecureConfig_CADH"
Before="MoveInsecureConfig_DECAC" >(NOT Installed) and INSECURE_CONFIG_FOUND</Custom>
<Custom Action="MoveInsecureConfig_DECAC" Before="CreateFolders" >(NOT Installed) and INSECURE_CONFIG_FOUND</Custom>
<Custom Action="BackupConfig_DECAC" Before="CreateFolders" >(NOT Installed) and (not INSECURE_CONFIG_FOUND) and (not MINION_CONFIG) and ((CONFIG_TYPE = "Custom") or (CONFIG_TYPE = "Default"))</Custom>
<Custom Action="MoveConfig_DECAC" Before="CreateFolders" >(NOT Installed) and MOVE_CONF</Custom>
<Custom Action="MoveInsecureConfig_CADH" Before="MoveInsecureConfig_DECAC" >(NOT Installed) and INSECURE_CONFIG_FOUND</Custom>
<Custom Action="MoveInsecureConfig_DECAC" Before="CreateFolders" >(NOT Installed) and INSECURE_CONFIG_FOUND</Custom>
<Custom Action="BackupConfig_DECAC" Before="CreateFolders" >(NOT Installed) and (not INSECURE_CONFIG_FOUND) and (not MINION_CONFIG) and ((CONFIG_TYPE = "Custom") or (CONFIG_TYPE = "Default"))</Custom>
<Custom Action="MoveConfig_DECAC" Before="CreateFolders" >(NOT Installed) and MOVE_CONF</Custom>
<Custom Action="WriteConfig_CADH" Before="WriteConfig_DECAC" >NOT Installed</Custom>
<Custom Action="WriteConfig_DECAC" After="WriteIniValues" >NOT Installed</Custom>
<Custom Action="WriteConfig_CADH" Before="WriteConfig_DECAC" >NOT Installed</Custom>
<Custom Action="WriteConfig_DECAC" After="WriteIniValues" >NOT Installed</Custom>
<!-- Optionally start the service -->
<StartServices Sequence="5900">START_MINION</StartServices>
<!-- On uninstall or upgrade: stop salt python.exe processes that would lock dll's -->
<Custom Action="kill_python_exe" After="StopServices" >(REMOVE ~= "ALL") or WIX_UPGRADE_DETECTED</Custom>
<Custom Action="kill_python_exe" After="StopServices" >(REMOVE ~= "ALL") or WIX_UPGRADE_DETECTED</Custom>
<!-- On uninstall (not upgrade): delete config and cache -->
<Custom Action="DeleteConfig_CADH"
Before="DeleteConfig_DECAC" >REMOVE ~= "ALL"</Custom>
<Custom Action="DeleteConfig_DECAC" After="RemoveFolders" >REMOVE ~= "ALL"</Custom>
<Custom Action="DeleteConfig_CADH" Before="DeleteConfig_DECAC" >REMOVE ~= "ALL"</Custom>
<Custom Action="DeleteConfig_DECAC" After="RemoveFolders" >REMOVE ~= "ALL"</Custom>
</InstallExecuteSequence>
@ -236,11 +228,9 @@ IMCAC - Immediate Custom Action - It's immediate
<CustomAction Id="DeleteConfig2_CADH" Property="DeleteConfig2_DECAC" Value="CLEAN_INSTALL=[CLEAN_INSTALL];REMOVE_CONFIG=[REMOVE_CONFIG];INSTALLDIR=[INSTALLDIR];ROOTDIR=[ROOTDIR];" />
<CustomAction Id="MoveInsecureConfig_CADH" Property="MoveInsecureConfig_DECAC" Value="INSECURE_CONFIG_FOUND=[INSECURE_CONFIG_FOUND];" />
<!-- Prevent downgrade -->
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- Install VC++ runtime -->
<DirectoryRef Id="TARGETDIR">
<!-- Visual C++ runtimes depend on the target platform -->
@ -259,7 +249,6 @@ IMCAC - Immediate Custom Action - It's immediate
</Component>
</DirectoryRef>
<!-- Assemble fixed and conditional features -->
<!-- Conditional features need attention for install and uninstall -->
<!-- Leaving registry keys would mean the product is still installed -->
@ -271,8 +260,8 @@ IMCAC - Immediate Custom Action - It's immediate
<!-- Get the config file template from the msi store only if no config is present -->
<Feature Id='GetConfigTemplate' Level='0'>
<ComponentGroupRef Id="DiscoveredConfigFiles" />
<Condition Level="1">GET_CONFIG_TEMPLATE_FROM_MSI_STORE or (REMOVE ~= "ALL")</Condition>
<ComponentGroupRef Id="DiscoveredConfigFiles" />
<Condition Level="1">GET_CONFIG_TEMPLATE_FROM_MSI_STORE or (REMOVE ~= "ALL")</Condition>
</Feature>
<ComponentGroup Id="ProductComponents" Directory="INSTALLDIR">
@ -291,23 +280,21 @@ IMCAC - Immediate Custom Action - It's immediate
<ComponentRef Id="register_remove_config" />
</ComponentGroup>
<!-- Icons -->
<Icon Id="icon.ico" SourceFile="pkg_resources\Product-icon.ico" />
<WixVariable Id="WixUIBannerBmp" Value="pkg_resources\Product-imgTop.jpg" />
<WixVariable Id="WixUIDialogBmp" Value="pkg_resources\Product-imgLeft.png" />
<WixVariable Id="WixUILicenseRtf" Value="pkg_resources\LICENSE.rtf" />
<!-- GUI
Built-in dialogs description ... https://wixtoolset.org//documentation/manual/v3/wixui/dialog_reference/wixui_dialogs.html
Dialogs appearing (* == built-in):
WelcomeDlg*
LicenseAgreementDlg*
HostsDlg
DirectoryDlg = InstallDirDlg*
VerifyReadyDlg*
<!--
GUI
Built-in dialogs description ... https://wixtoolset.org//documentation/manual/v3/wixui/dialog_reference/wixui_dialogs.html
Dialogs appearing (* == built-in):
WelcomeDlg*
LicenseAgreementDlg*
HostsDlg
DirectoryDlg = InstallDirDlg*
VerifyReadyDlg*
-->
<UI>
<TextStyle Id="WixUI_Font_Warning" FaceName="Tahoma" Size="8" Red="200" Bold="yes" />
@ -332,7 +319,6 @@ IMCAC - Immediate Custom Action - It's immediate
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="MasterLabel" Type="Text" X="20" Y="55" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Master (hostnames or IPv4, commma separated):" />
<Control Id="MasterId" Type="Edit" X="30" Y="70" Width="190" Height="15" Property="MASTER" />
<Control Id="MinionLabel" Type="Text" X="20" Y="85" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Minion:" />
@ -342,11 +328,11 @@ IMCAC - Immediate Custom Action - It's immediate
<Condition Action="hide"> MINION_CONFIG or INSECURE_CONFIG_FOUND or (not CONFIG_FOUND)</Condition>
</Control>
<Control Id="cbo_type" Type="ComboBox" X="75" Y="125" Width="60" Height="15" Property="CONFIG_TYPE" >
<ComboBox Property="CONFIG_TYPE">
<ListItem Value="Existing" />
<ListItem Value="Custom" />
<ListItem Value="Default" />
</ComboBox>
<ComboBox Property="CONFIG_TYPE">
<ListItem Value="Existing" />
<ListItem Value="Custom" />
<ListItem Value="Default" />
</ComboBox>
<Condition Action="show">not (MINION_CONFIG or INSECURE_CONFIG_FOUND or (not CONFIG_FOUND))</Condition>
<Condition Action="hide"> MINION_CONFIG or INSECURE_CONFIG_FOUND or (not CONFIG_FOUND)</Condition>
</Control>
@ -360,14 +346,13 @@ IMCAC - Immediate Custom Action - It's immediate
<Condition Action="hide">not (OLD_CONF_EXISTS)</Condition>
</Control>
<Control Id="Insecure1" Type="Text" X="20" Y="125" Width="320" Height="30" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Warning}Insecure config found at C:\salt\conf. If you continue, the config directory will be renamed and the default config will be used.">
<Condition Action="show"> INSECURE_CONFIG_FOUND and (not MINION_CONFIG) </Condition>
<Condition Action="hide">not (INSECURE_CONFIG_FOUND and (not MINION_CONFIG))</Condition>
<Condition Action="show"> INSECURE_CONFIG_FOUND and (not MINION_CONFIG) </Condition>
<Condition Action="hide">not (INSECURE_CONFIG_FOUND and (not MINION_CONFIG))</Condition>
</Control>
<Control Id="Insecure2" Type="Text" X="20" Y="125" Width="320" Height="30" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Warning}Insecure config found at C:\salt\conf. If you continue, the config directory will be renamed and the MINION_CONFIG property will be used.">
<Condition Action="show"> INSECURE_CONFIG_FOUND and MINION_CONFIG </Condition>
<Condition Action="hide">not (INSECURE_CONFIG_FOUND and MINION_CONFIG)</Condition>
<Condition Action="show"> INSECURE_CONFIG_FOUND and MINION_CONFIG </Condition>
<Condition Action="hide">not (INSECURE_CONFIG_FOUND and MINION_CONFIG)</Condition>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)"/>
@ -379,21 +364,18 @@ IMCAC - Immediate Custom Action - It's immediate
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="i1" Type="Text" X="20" Y="55" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Install program into directory:" />
<Control Id="i2" Type="PathEdit" X="30" Y="70" Width="250" Height="15" Property="INSTALLDIR" />
<Control Id="i3" Type="PushButton" X="280" Y="70" Width="40" Height="15" Text="Browse" >
<Publish Property="_BrowseProperty" Value="INSTALLDIR" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)" />
</Dialog>
</UI>
<!-- Default directory layout, Admin could modify by setting all affected directory id's -->
<Directory Id="TARGETDIR" Name="SourceDir"> <!-- Fixed expression. Location of the msi file -->
<Directory Id="$(var.PROGRAMFILES)"> <!-- C:\Program Files or C:\Program Files (x86) -->
@ -431,6 +413,7 @@ IMCAC - Immediate Custom Action - It's immediate
</Directory>
</Directory>
</Directory>
<!-- Set ROOTDIR to C:\salt if OLD_CONF_EXISTS and not MOVE_CONF (only before install sequence) -->
<SetDirectory Id="ROOTDIR" Value="C:\salt" Sequence="execute">OLD_CONF_EXISTS and (not MOVE_CONF)</SetDirectory>
<SetDirectory Id="CONFDIR" Value="C:\salt\conf" Sequence="execute">OLD_CONF_EXISTS and (not MOVE_CONF)</SetDirectory>
@ -465,65 +448,60 @@ IMCAC - Immediate Custom Action - It's immediate
<CreateFolder />
</Component>
<!-- Install Windows service (nssm and without)-->
<?if 1=1 ?>
<ComponentGroup Id="service">
<Component Id="cmp906378FA53882935FD2EC0CC58D32FAC" Directory="INSTALLDIR" Guid="{E27F3682-194D-4CC2-9F9B-F3E1D53ADCDB}">
<File Id="ssm.exe" KeyPath="yes" Source="$(var.DISCOVER_INSTALLDIR)\ssm.exe" />
<ServiceInstall
Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes"
Name="salt-minion"
Description="Salt Minion from saltproject.io"
DisplayName="salt-minion"
Id="si1">
<util:ServiceConfig
FirstFailureActionType="none"
SecondFailureActionType="none"
ThirdFailureActionType="none" />
</ServiceInstall>
<ServiceControl Name="salt-minion" Remove="uninstall" Stop="both" Start="install" Wait="yes" Id="sc1">
<ServiceArgument />
</ServiceControl>
<CreateFolder />
<util:EventSource Log="Application" Name="ssm" EventMessageFile="[#ssm.exe]" />
<RegistryKey Root="HKLM" Key="System\CurrentControlSet\Services\salt-minion">
<RegistryKey Key="Parameters">
<RegistryValue Type="expandable" Name="AppDirectory" Value="[INSTALLDIR]" />
<RegistryValue Type="expandable" Name="Application" Value="[INSTALLDIR]salt-minion.exe" />
<RegistryValue Type="expandable" Name="AppParameters" Value='-c "[ROOTDIR]conf" -l quiet' />
<RegistryValue Type="integer" Name="AppStopMethodConsole" Value="24000" />
<RegistryValue Type="integer" Name="AppStopMethodWindow" Value="2000" />
<RegistryValue Type="integer" Name="AppRestartDelay" Value="60000" />
<RegistryKey Key="AppExit">
<RegistryValue Type="string" Value="Restart" />
<ComponentGroup Id="service">
<Component Id="cmp906378FA53882935FD2EC0CC58D32FAC" Directory="INSTALLDIR" Guid="{E27F3682-194D-4CC2-9F9B-F3E1D53ADCDB}">
<File Id="ssm.exe" KeyPath="yes" Source="$(var.DISCOVER_INSTALLDIR)\ssm.exe" />
<ServiceInstall
Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes"
Name="salt-minion"
Description="Salt Minion from saltproject.io"
DisplayName="salt-minion"
Id="si1">
<util:ServiceConfig
FirstFailureActionType="none"
SecondFailureActionType="none"
ThirdFailureActionType="none" />
</ServiceInstall>
<ServiceControl Name="salt-minion" Remove="uninstall" Stop="both" Start="install" Wait="yes" Id="sc1">
<ServiceArgument />
</ServiceControl>
<CreateFolder />
<util:EventSource Log="Application" Name="ssm" EventMessageFile="[#ssm.exe]" />
<RegistryKey Root="HKLM" Key="System\CurrentControlSet\Services\salt-minion">
<RegistryKey Key="Parameters">
<RegistryValue Type="expandable" Name="AppDirectory" Value="[INSTALLDIR]" />
<RegistryValue Type="expandable" Name="Application" Value="[INSTALLDIR]salt-minion.exe" />
<RegistryValue Type="expandable" Name="AppParameters" Value='-c "[ROOTDIR]conf" -l quiet' />
<RegistryValue Type="integer" Name="AppStopMethodConsole" Value="24000" />
<RegistryValue Type="integer" Name="AppStopMethodWindow" Value="2000" />
<RegistryValue Type="integer" Name="AppRestartDelay" Value="60000" />
<RegistryKey Key="AppExit">
<RegistryValue Type="string" Value="Restart" />
</RegistryKey>
</RegistryKey>
</RegistryKey>
</RegistryKey>
</Component>
</ComponentGroup>
</Component>
</ComponentGroup>
<?else ?>
<!-- For the far future, in which nssm.exe is no longer used -->
<ComponentGroup Id="service">
<Component Id="servicec1" Directory="INSTALLDIR" Guid="51713960-fbe7-4e87-9472-66e3c18f76cd">
<File Source="$(var.DISCOVER_INSTALLDIR)\salt-minion.exe" KeyPath="yes" />
<ServiceInstall Name="salt-minion" DisplayName="Salt Minion" Description="Salt Minion from saltproject.io"
Arguments="-c [ROOTDIR]conf -l quiet"
Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" >
<util:ServiceConfig
FirstFailureActionType="none"
SecondFailureActionType="none"
ThirdFailureActionType="none" />
</ServiceInstall>
<ServiceControl Name="salt-minion" Start="install" Stop="both" Remove="uninstall" Wait="yes" Id="ServiceControl">
<ServiceArgument /> <!-- http://stackoverflow.com/questions/10621082/wix-serviceinstall-arguments -->
</ServiceControl>
</Component>
</ComponentGroup>
<!-- For the far future, in which nssm.exe is no longer used -->
<ComponentGroup Id="service">
<Component Id="servicec1" Directory="INSTALLDIR" Guid="51713960-fbe7-4e87-9472-66e3c18f76cd">
<File Source="$(var.DISCOVER_INSTALLDIR)\salt-minion.exe" KeyPath="yes" />
<ServiceInstall Name="salt-minion" DisplayName="Salt Minion" Description="Salt Minion from saltproject.io"
Arguments="-c [ROOTDIR]conf -l quiet"
Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" >
<util:ServiceConfig
FirstFailureActionType="none"
SecondFailureActionType="none"
ThirdFailureActionType="none" />
</ServiceInstall>
<ServiceControl Name="salt-minion" Start="install" Stop="both" Remove="uninstall" Wait="yes" Id="ServiceControl">
<ServiceArgument /> <!-- http://stackoverflow.com/questions/10621082/wix-serviceinstall-arguments -->
</ServiceControl>
</Component>
</ComponentGroup>
<?endif ?>
<!-- Do not create cab files -->
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
</Product>
</Wix>