forked from saltstack/salt-windows-msi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Product.wxs
522 lines (458 loc) · 31 KB
/
Product.wxs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
<?xml version="1.0" encoding="UTF-8"?>
<!--
>> - Ends With
<< - Starts With - Requires CDATA because < is a key character in xml
CADH - Custom Action Data Helper - Sends variables from the client to the server
One way only (send only)
Runs as Administrator
DECAC - Deferred Custom Action - It is run by the msiserver service, local system
Runs as LOCAL_SYSTEM
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">
<!-- Install per Machine -->
<Package InstallScope="perMachine" InstallerVersion="500" Compressed="yes" />
<!-- Abort installation if conditions are met -->
<?if $(var.WIN64)="no" ?>
<Condition Message="The 32bit variant must be installed on 32bit Windows.">not VersionNT64</Condition>
<?endif?>
<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)
</Condition>
<Condition Message="Installation requires 125 MB RAM. Found [PhysicalMemory] MB">Installed OR (PhysicalMemory > 125)</Condition>
<!--
ReadConfig_IMCAC must run immediately as Admin, the msi cannot elevate
before deferred, so the user must be Admin. We need to run with elevated
privileges in order to read the minion config, if it exists, and get the
currently configured master and minion id.
-->
<Condition Message="Searching for configuration requires Administrator privileges. Please open from an elevated command prompt.">Privileged</Condition>
<Condition Message="CONFIG_TYPE must not be "[CONFIG_TYPE]". Please use "Existing", "Custom" or "Default".">
Installed
OR (CONFIG_TYPE = "Existing")
OR (CONFIG_TYPE = "Custom")
OR (CONFIG_TYPE = "Default")
</Condition>
<!-- Properties default values. For Properties unset by default see README.md -->
<Property Id="CONFIG_TYPE" Value="Default" />
<Property Id="START_MINION" Value="1" />
<Property Id="ROOTDRIVE" Value="C:\" /> <!-- prevent msi to chose the drive with most space left -->
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- Allow command line alias for Property -->
<SetProperty Id="INSTALLDIR" Value="[INSTALLFOLDER]" Before="LaunchConditions">INSTALLFOLDER</SetProperty>
<!-- MINION_CONFIG implies REMOVE_CONFIG -->
<SetProperty Id="REMOVE_CONFIG" Value="1" Before="LaunchConditions">MINION_CONFIG</SetProperty>
<!-- Search for old config minion file -->
<Property Id="OLD_CONF_EXISTS">
<DirectorySearch Id="conf_old" Path="C:\salt\conf">
<FileSearch Name="minion" />
</DirectorySearch>
</Property>
<!-- Search for new config minion file -->
<Property Id="NEW_CONF_EXISTS">
<DirectorySearch Id="conf_new" Path="C:\ProgramData\Salt Project\Salt\conf">
<FileSearch Name="minion" />
</DirectorySearch>
</Property>
<!-- 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 ?>
<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 ?>
<RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" Name="REMOVE_CONFIG" Win64="no" Type="raw" Id="p4" />
</Property>
<!-- Write registry (declare components) and delete on uninstall -->
<Component Id="register_dirs" Directory="TARGETDIR">
<RegistryKey Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)">
<RegistryValue Name="install_dir" Value="[INSTALLDIR]" Type="string" />
<RegistryValue Name="root_dir" Value="[ROOTDIR]" Type="string" />
</RegistryKey>
</Component>
<Component Id="register_remove_config" Directory="TARGETDIR">
<Condition>REMOVE_CONFIG</Condition>
<RegistryKey Root="HKLM" Key="SOFTWARE\$(var.MANUFACTURER)\$(var.PRODUCTDIR)" ForceDeleteOnUninstall="yes" >
<RegistryValue Name="REMOVE_CONFIG" Value="1" Type="string" />
</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" />
<RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Salt Minion" Name="UninstallString" Type="raw" Win64="yes" Id="n2" />
</Property>
<!-- Detect NSIS install -->
<SetProperty Id="nsis_install_found" Before="LaunchConditions" Value="1">NSIS_UNINSTALLSTRING >> "uninst.exe"</SetProperty>
<!--
We need to stop the salt-minion before validating the installation. Part
of validation looks at the log file. If it is locked, it will 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
Set objShell = CreateObject("WScript.Shell")
objShell.Run "net stop salt-minion", 0, true
</CustomAction>
<!-- This is the import statement for the Custom Actions:
IMCAC, DECAC, etc...
-->
<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".
-->
<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.
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.
-->
<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>
<!-- 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>
<!-- 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="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>
<!-- 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>
<!-- 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>
</InstallExecuteSequence>
<!-- Declare Immediate (*_IMCAC) and deferred (*_DECAC) custom actions. -->
<!-- These are the entry points into the DLL -->
<CustomAction Id="ReadConfig_IMCAC" BinaryKey="MinionConfigExt" DllEntry="ReadConfig_IMCAC" Execute="firstSequence" />
<CustomAction Id="del_NSIS_DECAC" BinaryKey="MinionConfigExt" DllEntry="del_NSIS_DECAC" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="MoveInsecureConfig_DECAC" BinaryKey="MinionConfigExt" DllEntry="MoveInsecureConfig_DECAC" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="MoveConfig_DECAC" BinaryKey="MinionConfigExt" DllEntry="MoveConfig_DECAC" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="WriteConfig_DECAC" BinaryKey="MinionConfigExt" DllEntry="WriteConfig_DECAC" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="DeleteConfig_DECAC" BinaryKey="MinionConfigExt" DllEntry="DeleteConfig_DECAC" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="DeleteConfig2_DECAC" BinaryKey="MinionConfigExt" DllEntry="DeleteConfig_DECAC" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="BackupConfig_DECAC" BinaryKey="MinionConfigExt" DllEntry="BackupConfig_DECAC" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="kill_python_exe" BinaryKey="MinionConfigExt" DllEntry="kill_python_exe" Execute="deferred" Return="check" Impersonate="no" />
<!-- Custom Action Data Helper for deferred custom actions -->
<!-- master and id must be named like in YAML configuration -->
<!-- Send all this stuff down to the sandbox -->
<CustomAction Id="WriteConfig_CADH" Property="WriteConfig_DECAC" Value="master=[MASTER];id=[MINION_ID];MOVE_CONF=[MOVE_CONF];sourcedir=[SOURCEDIR];INSTALLDIR=[INSTALLDIR];ROOTDIR=[ROOTDIR];CONFDIR=[CONFDIR];config_type=[CONFIG_TYPE];MINION_CONFIG=[MINION_CONFIG];custom_config=[CUSTOM_CONFIG];" />
<CustomAction Id="DeleteConfig_CADH" Property="DeleteConfig_DECAC" Value="CLEAN_INSTALL=[CLEAN_INSTALL];REMOVE_CONFIG=[REMOVE_CONFIG];INSTALLDIR=[INSTALLDIR];ROOTDIR=[ROOTDIR];" />
<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 -->
<?if $(var.WIN64)=yes ?>
<Merge Id="MSM_VC120_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC120_CRT_x64.msm" DiskId="1" Language="0" />
<Merge Id="MSM_VC140_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC140_CRT_x64.msm" DiskId="1" Language="0" />
<?else ?>
<Merge Id="MSM_VC120_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC120_CRT_x86.msm" DiskId="1" Language="0" />
<Merge Id="MSM_VC140_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC140_CRT_x86.msm" DiskId="1" Language="0" />
<?endif ?>
</DirectoryRef>
<!-- Add INSTALLDIR to the system Path -->
<DirectoryRef Id="TARGETDIR">
<Component Id="INSTALLDIR_System_Path" Guid="A9F54641-91F8-4AFB-B812-9409E6EA0192">
<Environment Id="Env_PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="no" Part="last" Action="set" System="yes" />
</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 -->
<Feature Id="ProductFeature" Title="Minion" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<Feature Id="VC120" Title="VC++ 2013" AllowAdvertise="no" Display="hidden"><MergeRef Id="MSM_VC120_CRT" /></Feature>
<Feature Id="VC140" Title="VC++ 2015" AllowAdvertise="no" Display="hidden"><MergeRef Id="MSM_VC140_CRT" /></Feature>
</Feature>
<!-- 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>
</Feature>
<ComponentGroup Id="ProductComponents" Directory="INSTALLDIR">
<ComponentGroupRef Id="DiscoveredBinaryFiles" />
<ComponentGroupRef Id="service" />
<ComponentRef Id="INSTALLDIR_Permissions" />
<ComponentRef Id="ROOTDIR_Permissions" />
<ComponentRef Id="CreateMinionDDir" />
<ComponentRef Id="CreatePKIMinionDir" />
<ComponentRef Id="CreateRunDir" />
<ComponentRef Id="CreateLogSaltDir" />
<ComponentRef Id="CreateProcDir" />
<ComponentRef Id="CreateGrainsDir" />
<ComponentRef Id="INSTALLDIR_System_Path" />
<ComponentRef Id="register_dirs" />
<ComponentRef Id="register_remove_config" />
</ComponentGroup>
<!-- Icons -->
<Icon Id="icon.ico" SourceFile="Product-icon.ico" />
<WixVariable Id="WixUIBannerBmp" Value="Product-imgTop.jpg" />
<WixVariable Id="WixUIDialogBmp" Value="Product-imgLeft.png" />
<WixVariable Id="WixUILicenseRtf" Value="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*
-->
<UI>
<TextStyle Id="WixUI_Font_Warning" FaceName="Tahoma" Size="8" Red="200" Bold="yes" />
<UIRef Id="WixUI_Mondo" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="HostsDlg" Order="3">LicenseAccepted = "1"</Publish>
<Publish Dialog="HostsDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="HostsDlg" Control="Next" Event="NewDialog" Value="DirectoryDlg" >1</Publish>
<Publish Dialog="HostsDlg" Control="Cancel" Event="SpawnDialog" Value="CancelDlg" >1</Publish>
<Publish Dialog="DirectoryDlg" Control="Back" Event="NewDialog" Value="HostsDlg" >1</Publish>
<Publish Dialog="DirectoryDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" >1</Publish>
<Publish Dialog="DirectoryDlg" Control="Cancel" Event="SpawnDialog" Value="CancelDlg" >1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="DirectoryDlg" >1</Publish>
<Dialog Id="HostsDlg" Width="370" Height="270" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="15" Y="6" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Minion configuration" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Please verify master and minion." />
<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:" />
<Control Id="MinionId" Type="Edit" X="30" Y="100" Width="190" Height="15" Property="MINION_ID" />
<Control Id="cbt_type" Type="Text" X="20" Y="125" Width="45" Height="15" Transparent="yes" NoPrefix="yes" Text="Config type:">
<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>
<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>
<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>
<Control Id="StartService" Type="CheckBox" X="25" Y="150" Width="280" Height="15" Property="START_MINION" CheckBoxValue="1" Text="&Start salt-minion service immediately" />
<Control Id="HideInARP" Type="CheckBox" X="25" Y="165" Width="280" Height="15" Property="ARPSYSTEMCOMPONENT" CheckBoxValue="1" Text="&Hide in 'Programs and Features'" />
<Control Id="conf_txt" Type="Text" X="36" Y="182" Width="130" Height="15" Text="Remove configuration and cache:" />
<Control Id="clean_inst" Type="CheckBox" X="166" Y="180" Width="70" Height="15" Property="CLEAN_INSTALL" CheckBoxValue="1" Text="B&efore upgrade" />
<Control Id="remove_conf" Type="CheckBox" X="244" Y="180" Width="60" Height="15" Property="REMOVE_CONFIG" CheckBoxValue="1" Text="&On uninstall" />
<Control Id="move_conf" Type="CheckBox" X="25" Y="195" Width="280" Height="15" Property="MOVE_CONF" CheckBoxValue="1" Text="&Move configuration from "C:\salt" to "C:\ProgramData\Salt Project"">
<Condition Action="show"> OLD_CONF_EXISTS</Condition>
<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>
</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>
</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>
<Dialog Id="DirectoryDlg" Width="370" Height="270" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Installation directory" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Please specify the installation directory." />
<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) -->
<Directory Id="installparent" Name="$(var.MANUFACTURER)">
<Directory Id="INSTALLDIR" Name="$(var.PRODUCTDIR)" />
</Directory>
</Directory>
<!-- Default layout for the ROOTDIR, this is always in ProgramData -->
<Directory Id="CommonAppDataFolder"> <!-- C:\ProgramData -->
<Directory Id="rootparent" Name="$(var.MANUFACTURER)">
<Directory Id="ROOTDIR" Name="$(var.PRODUCTDIR)">
<Directory Id="CONFDIR" Name="conf">
<Directory Id="MINIONDDIR" Name="minion.d" />
<Directory Id="PKIDIR" Name="pki">
<Directory Id="PKIMINIONDIR" Name="minion" />
</Directory>
</Directory>
<Directory Id="VARDIR" Name="var">
<Directory Id="RUNDIR" Name="run" />
<Directory Id="LOGDIR" Name="log">
<Directory Id="LOGSALTDIR" Name="salt" />
</Directory>
<Directory Id="CACHEDIR" Name="cache">
<Directory Id="CACHESALTDIR" Name="salt">
<Directory Id="CACHESALTMINIONDIR" Name="minion">
<Directory Id="PROCDIR" Name="proc" />
<Directory Id="EXTMODSDIR" Name="extmods">
<Directory Id="GRAINSDIR" Name="grains" />
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</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>
<!-- Set ownership to 'Localized qualified name of the Administrators group' -->
<PropertyRef Id="WIX_ACCOUNT_ADMINISTRATORS" />
<Component Id="INSTALLDIR_Permissions" Directory="INSTALLDIR" Guid="B30E119F-0286-4453-8AB7-C6E916FA2843">
<CreateFolder>
<Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" GenericAll="yes" TakeOwnership="yes" />
</CreateFolder>
</Component>
<Component Id="ROOTDIR_Permissions" Directory="ROOTDIR" Guid="84554438-6807-4d92-b602-7fce831b01a3">
<CreateFolder>
<Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" GenericAll="yes" TakeOwnership="yes" />
</CreateFolder>
</Component>
<Component Id="CreateMinionDDir" Directory="MINIONDDIR" Guid="59E64BE0-284C-4482-987C-416F4BD20A4C">
<CreateFolder />
</Component>
<Component Id="CreatePKIMinionDir" Directory="PKIMINIONDIR" Guid="F907613B-3669-4AB2-9630-A8ECDD50F157">
<CreateFolder />
</Component>
<Component Id="CreateRunDir" Directory="RUNDIR" Guid="BB3727B5-4C46-4622-BF08-F69E5004D817">
<CreateFolder />
</Component>
<Component Id="CreateLogSaltDir" Directory="LOGSALTDIR" Guid="BE111495-EE66-4BD0-9111-1373C2F78AE1">
<CreateFolder />
</Component>
<Component Id="CreateProcDir" Directory="PROCDIR" Guid="3B92D253-189F-4100-A21D-4FD7C45F5CD9">
<CreateFolder />
</Component>
<Component Id="CreateGrainsDir" Directory="GRAINSDIR" Guid="2F08218A-45C6-4E51-970C-DCB2530D36C5">
<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)\bin\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="nssm" EventMessageFile="[#ssm.exe]" />
<RegistryKey Root="HKLM" Key="System\CurrentControlSet\Services\salt-minion">
<RegistryKey Key="Parameters">
<RegistryValue Type="expandable" Name="AppDirectory" Value="[INSTALLDIR]bin" />
<RegistryValue Type="expandable" Name="Application" Value="[INSTALLDIR]bin\python.exe" />
<RegistryValue Type="expandable" Name="AppParameters" Value='-E -s "[INSTALLDIR]bin\Scripts\salt-minion" -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>
</Component>
</ComponentGroup>
<?else ?>
<ComponentGroup Id="service">
<Component Id="servicec1" Directory="INSTALLDIR" Guid="51713960-fbe7-4e87-9472-66e3c18f76cd">
<File Source="$(var.DISCOVER_INSTALLDIR)\bin\python.exe" KeyPath="yes" />
<ServiceInstall Name="salt-minion" DisplayName="Salt Minion" Description="Salt Minion from saltproject.io"
Arguments="[INSTALLDIR]\bin\Scripts\salt-minion -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>