-
Notifications
You must be signed in to change notification settings - Fork 1
/
Product.wxs
272 lines (224 loc) · 12.3 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
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!--
Unattended setup: The following variables can be set:
- INSTALLDIR: Full path to the installation directory
- SERVERS: Splunk servers to send data to
-->
<!--
====================================================================================
Defines & Variables
-->
<!-- Full version number to display -->
<?define VersionNumber="!(bind.FileVersion.uberAgentExe)" ?>
<!--
Upgrade code HAS to be the same for all updates.
Once you've chosen it don't change it.
-->
<?define UpgradeCode="$(var.ProductUpgradeCode)" ?>
<!-- The URL for add/remove programs -->
<?define InfoURL="https://helgeklein.com/" ?>
<!-- 32-bit / 64-bit variables -->
<?if $(var.Platform) = x64 ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define uberAgentExeSourcePath = "$(var.ProjectDir)\uberAgent.exe" ?>
<?else ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define uberAgentExeSourcePath = "$(var.ProjectDir)\uberAgent.exe" ?>
<?endif ?>
<!--
====================================================================================
Package start
-->
<!-- The upgrade code must never change as long as the product lives! -->
<!-- Product IDs must be autogenerated (*) or else major upgrades will not work -->
<Product Id="*"
Name="!(loc.ApplicationName)" Language="!(loc.Language)" Version="$(var.VersionNumber)"
Manufacturer="!(loc.ManufacturerFullName)" UpgradeCode="$(var.UpgradeCode)" >
<!-- Package IDs are valid for a single package version only - they are autogenerated by WiX -->
<!-- Let's require Windows Installer 4.0 (included in Vista) -->
<!-- And ALWAYS install per machine!!! -->
<Package Id="*"
InstallerVersion="400" Compressed="yes" InstallScope="perMachine"
Description="!(loc.ProductDescription)" Comments="!(loc.Comments) $(var.VersionNumber)" />
<!-- License agreement text: dummy. Real text is set in WXS file -->
<WixVariable Id="WixUILicenseRtf" Value="dummy" />
<!-- UI customization -->
<WixVariable Id="WixUIBannerBmp" Value="!(bindpath.images)\BannerTop.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="!(bindpath.images)\Dialog.bmp" />
<!-- Define icons (ID should not be longer than 18 chars and must end with ".exe") -->
<Icon Id="Icon.exe" SourceFile="!(bindpath.images)\app.ico" />
<!-- Set properties for add/remove programs -->
<Property Id="ARPPRODUCTICON" Value="Icon.exe" />
<Property Id="ARPHELPLINK" Value="$(var.InfoURL)" />
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
<Property Id="ARPNOMODIFY" Value="yes" Secure="yes" /> <!-- Remove modify -->
<!-- Upgrade logic -->
<!-- AllowSameVersionUpgrades -> Always upgrade, never allow two versions to be installed next to each other -->
<!-- AllowSameVersionUpgrades causes ICE61 which must be ignored -->
<MajorUpgrade DowngradeErrorMessage="!(loc.NewerInstalled)" AllowSameVersionUpgrades="yes" />
<!-- This is the main installer sequence run when the product is actually installed -->
<InstallExecuteSequence>
<!-- Determine the install location after the install path has been validated by the installer -->
<Custom Action="SetARPINSTALLLOCATION" After="InstallValidate"></Custom>
</InstallExecuteSequence>
<!-- Set up ARPINSTALLLOCATION property (http://blogs.technet.com/b/alexshev/archive/2008/02/09/from-msi-to-wix-part-2.aspx) -->
<CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
<!--
Launch conditions
1. Check minimum OS version
If not, the installation is aborted.
By doing the (Installed OR ...) property means that this condition will only
be evaluated if the app is being installed and not on uninstall or changing
Note: Under a Product element, a condition becomes a LaunchCondition entry.
-->
<Condition Message="!(loc.OS2Old)">
<![CDATA[Installed OR (VersionNT >= 600)]]>
</Condition>
<!--
2. Check OS bitness
Unfortunately 32-bit MSI packages cannot write to 64-bit ProgramFiles directory.
That is the only reason we need separate MSIs for 32-bit and 64-bit.
-->
<?if $(var.Platform) = x64 ?>
<Condition Message="!(loc.x86VersionRequired)">
<![CDATA[VersionNT64]]>
</Condition>
<?endif?>
<?if $(var.Platform) = x86 ?>
<Condition Message="!(loc.x64VersionRequired)">
<![CDATA[NOT VersionNT64]]>
</Condition>
<?endif?>
<!--
Launch conditions end
-->
<!-- Save the command line value INSTALLDIR and restore it later in the sequence -->
<!-- or it will be overwritten by the value saved to the registry during an upgrade -->
<!-- http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/ -->
<CustomAction Id='SaveCmdLineValueINSTALLDIR' Property='CMDLINE_INSTALLDIR' Value='[INSTALLDIR]' Execute='firstSequence' />
<CustomAction Id='SetFromCmdLineValueINSTALLDIR' Property='INSTALLDIR' Value='[CMDLINE_INSTALLDIR]' Execute='firstSequence' />
<InstallUISequence>
<Custom Action='SaveCmdLineValueINSTALLDIR' Before='AppSearch' />
<Custom Action='SetFromCmdLineValueINSTALLDIR' After='AppSearch'>
CMDLINE_INSTALLDIR
</Custom>
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action='SaveCmdLineValueINSTALLDIR' Before='AppSearch' />
<Custom Action='SetFromCmdLineValueINSTALLDIR' After='AppSearch'>
CMDLINE_INSTALLDIR
</Custom>
</InstallExecuteSequence>
<!-- Save the command line value SERVERS and restore it later in the sequence -->
<!-- or it will be overwritten by the value saved to the registry during an upgrade -->
<!-- http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/ -->
<CustomAction Id='SaveCmdLineValueSERVERS' Property='CMDLINE_SERVERS' Value='[SERVERS]' Execute='firstSequence' />
<CustomAction Id='SetFromCmdLineValueSERVERS' Property='SERVERS' Value='[CMDLINE_SERVERS]' Execute='firstSequence' />
<InstallUISequence>
<Custom Action='SaveCmdLineValueSERVERS' Before='AppSearch' />
<Custom Action='SetFromCmdLineValueSERVERS' After='AppSearch'>
CMDLINE_SERVERS
</Custom>
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action='SaveCmdLineValueSERVERS' Before='AppSearch' />
<Custom Action='SetFromCmdLineValueSERVERS' After='AppSearch'>
CMDLINE_SERVERS
</Custom>
</InstallExecuteSequence>
<!-- Determine the directory of a previous installation (if one exists). If not INSTALLDIR stays empty -->
<Property Id="INSTALLDIR">
<RegistrySearch Id="DetermineInstallLocation"
Type="raw" Root="HKLM"
Key="Software\!(loc.ManufacturerName)\InstalledProducts\!(loc.ApplicationName)" Name="InstallLocation" />
</Property>
<!-- Determine the servers of a previous installation -->
<Property Id="SERVERS">
<RegistrySearch Id="DetermineServers"
Type="raw" Root="HKLM"
Key="Software\!(loc.ManufacturerName)\InstalledProducts\!(loc.ApplicationName)" Name="Servers" />
</Property>
<!-- Set default value if registry search comes up empty -->
<SetProperty Before='InstallInitialize' Sequence='execute' Id='SERVERS' Value='localhost:19500'>
NOT SERVERS
</SetProperty>
<!--
====================================================================================
Start to build directory structure
-->
<!-- We do not have more than one medium (Floppy, CD, ...). Everything in one file. -->
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<!-- Outermost folder (kind of virtual). Fixed entry. -->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- We start building our directory structure here -->
<!-- "ProgramFilesFolder" is a variable containing the absolute path. -->
<!-- For a list of folder variables, see: http://msdn.microsoft.com/en-us/library/aa372057%28VS.85%29.aspx -->
<Directory Id="$(var.PlatformProgramFilesFolder)">
<!-- All folders from here on are relative to their parent. -->
<Directory Id="ProgramFilesHK" Name="!(loc.ManufacturerName)">
<!-- INSTALLDIR is a property name. We need it later for the UI (to be able to change the install dir. -->
<Directory Id="INSTALLDIR" Name="!(loc.ApplicationName)">
<!-- Define components, the building blocks of MSIs. -->
<!-- Rule: A component should only contain items that belong together so strongly that they always need to be installed or removed together. -->
<!-- If this means a single file, then your components will contain a single file each. This is not only normal but exactly what you're -->
<!-- to do. Don't be afraid, Windows Installer can efficiently handle thousands of components or more, if needed. -->
<!-- Installation directory as a component so it can be emptied during uninstall -->
<!-- (by default files added by someone other than Windows Installer are not removed) -->
<Component Id="INSTALLDIR_comp" Guid="PUT-GUID-HERE">
<CreateFolder />
<RemoveFile Id="RemoveFilesFromAppDirectory" Name="*.*" On="uninstall" />
</Component>
<!-- Main program file -->
<Component Id="uberAgent.exe_comp" Guid="PUT-GUID-HERE">
<File Source="$(var.uberAgentExeSourcePath)" Id="uberAgentExe" KeyPath="yes" />
<ServiceInstall Id="ServiceInstaller"
Account="LocalSystem" Description="!(loc.ServiceDescription)"
DisplayName="!(loc.ServiceDisplayName)" ErrorControl="normal"
LoadOrderGroup="NetworkProvider" Name="uberAgentSvc"
Start="auto" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ServiceControl" Name="uberAgentSvc" Start="install" Stop="both" Remove="uninstall" />
</Component>
<!-- Configuration file -->
<Component Id="uberAgent.conf_comp" Guid="PUT-GUID-HERE">
<File Source="$(var.ProjectDir)\uberAgent.conf" Id="uberAgentConf" KeyPath="yes" />
<IniFile Id="ConfigFile" Action="addLine" Directory="INSTALLDIR" Name="uberAgent.conf" Section="Receiver" Key="Servers" Value="[SERVERS]" />
</Component>
</Directory>
</Directory>
</Directory>
<!-- Registry entries -->
<Component Id="RegValInstallLocation_comp" Guid="PUT-GUID-HERE">
<!-- Do NOT use the application's default registry key here, because THIS key will be removed on uninstall
(important when installing a newer version, because that is uninstall followed by install) -->
<RegistryKey Root="HKLM" Key="Software\!(loc.ManufacturerName)\InstalledProducts\!(loc.ApplicationName)">
<RegistryValue Name="InstallLocation" Value="[INSTALLDIR]" Type="string" KeyPath="yes" />
<RegistryValue Name="Servers" Value="[SERVERS]" Type="string" />
</RegistryKey>
</Component>
</Directory>
<!--
End of directory structure
====================================================================================
-->
<!-- Features define which parts of the application can be installed in a custom installation -->
<Feature Id="Complete" Title="!(loc.ApplicationName)" Description="!(loc.FeatureCompleteDescription)" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
<!-- A feature block for the main (GUI) program and all its dependencies -->
<Feature Id="MainProgram" Title="!(loc.FeatureMainProgramTitle)" Description="!(loc.FeatureMainProgramDescription)" Level="1">
<ComponentRef Id="INSTALLDIR_comp" />
<ComponentRef Id="uberAgent.exe_comp" />
<ComponentRef Id="uberAgent.conf_comp" />
<!-- Registry entries -->
<ComponentRef Id="RegValInstallLocation_comp" />
</Feature>
</Feature>
<UI>
<!-- Define the installer UI -->
<UIRef Id="WixUI_HK" />
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="WIXUI_SERVERS" Value="SERVERS" />
</Product>
</Wix>