-
Notifications
You must be signed in to change notification settings - Fork 24
/
ktranslate.wxs
257 lines (241 loc) · 17.7 KB
/
ktranslate.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
<?xml version="1.0" encoding="utf-8"?>
<?ifndef var.Version?>
<?error Undefined Version variable?>
<?endif?>
<?ifndef var.Path?>
<?error Undefined Path variable?>
<?endif?>
<?ifndef var.SnmpProfilesPath?>
<?error Undefined SnmpProfilesPath variable?>
<?endif?>
<?ifndef env.ProductCode?>
<?error Undefined ProductCode variable?>
<?endif?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define UpgradeCode = "9f8c4b67-4ea7-4273-a9c7-e62a97989a49" ?>
<?define CommonServiceArgs = '-listen=off -geo="c:\Program Files\KTranslate\config\GeoLite2-Country.mmdb" -asn="c:\Program Files\KTranslate\config\GeoLite2-ASN.mmdb" -snmp="c:\Program Files\KTranslate\snmp-win.yaml" -metrics=jchf -tee_logs=true' ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="$(env.ProductCode)"
UpgradeCode="$(var.UpgradeCode)"
Name="ktranslate"
Version="$(var.Version)"
Manufacturer="Kentik Technologies, Inc."
Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" Platform="x64" InstallScope="perMachine" />
<MajorUpgrade AllowDowngrades="no" DowngradeErrorMessage="A newer version of [ProductName] is already installed" AllowSameVersionUpgrades="no" />
<Media Id="1" Cabinet="ktranslate.cab" EmbedCab="yes" />
<!-- Set properties -->
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONROOTDIRECTORY" />
<Property Id="SERVICE_TYPE" Value="snmp" />
<Property Id="FLOW_TYPE" Value="sflow" />
<SetProperty Action="SetSnmpServiceArgsProp" Id="ServiceArgs" Before="InstallInitialize" Sequence="execute" Value="$(var.CommonServiceArgs) nr1.snmp">
<![CDATA[SERVICE_TYPE="snmp"]]>
</SetProperty>
<SetProperty Action="SetFlowServiceArgsProp" Id="ServiceArgs" Before="InstallInitialize" Sequence="execute" Value="$(var.CommonServiceArgs) -flow_only=true -nf.source=[FLOW_TYPE] nr1.flow">
<![CDATA[SERVICE_TYPE="flow"]]>
</SetProperty>
<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="KTranslate"/>
</Directory>
</Directory>
<!-- Step 2: Add files to your installer package -->
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Win64="$(var.Win64)" Id="ktranslate.exe" Guid="c52f95af-35e2-4c2c-9d3d-a375b7ecdea2">
<File Id="ktranslate.exe" Source="$(var.Path)/bin/ktranslate.exe" KeyPath="yes"/>
<!-- Set environment variables -->
<Environment Id="NewReLicApiKeyEnv" Name="NEW_RELIC_API_KEY" Value="[NEW_RELIC_API_KEY]" Action="set" Part="all" System="yes" Permanent="no" />
<Environment Id="NewReLicAccountIdEnv" Name="NR_ACCOUNT_ID" Value="[NR_ACCOUNT_ID]" Action="set" Part="all" System="yes" Permanent="no" />
<Environment Id="NewReLicRegionEnv" Name="NR_REGION" Value="[NR_REGION]" Action="set" Part="all" System="yes" Permanent="no" />
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="ktranslate"
DisplayName="Ktranslate"
Description="KTranslate - Kentik data to the world"
Start="auto"
Account="NT AUTHORITY\LocalService"
ErrorControl="normal"
Arguments="[ServiceArgs]" />
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ktranslate" Wait="no" />
</Component>
</DirectoryRef>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Directory Id="ConfigDir" Name="config">
<Component Win64="$(var.Win64)" Id="cmpB46AF4C0CF9C68FA9C458C1219F7C1D1" Guid="*">
<File Id="fil3A4553518059793557B7F50FFD0CF595" KeyPath="yes" Source="$(var.Path)/config/config.json"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp5DC89FB017DD270B8ABBA3EAEA6CB0D6" Guid="*">
<File Id="filA0DB0D8C236B92390DB66A16DE42191A" KeyPath="yes" Source="$(var.Path)/config/devices.json"/>
</Component>
<Directory Id="dir3BE438191BBAD79B8E1207EF7306FBF8" Name="mibs.db">
<Component Win64="$(var.Win64)" Id="cmp010B68C74E1BD336334B89C05B695C7C" Guid="*">
<File Id="fil05BCF2FBC59F339FB09FA5638E98EEDB" KeyPath="yes" Source="$(var.Path)/config/mibs.db/000243.ldb"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmpE73AD12A4250D0F6EE204100038250B4" Guid="*">
<File Id="fil763D7F7D25FDD7EC22BE25F6FD6C8A89" KeyPath="yes" Source="$(var.Path)/config/mibs.db/MANIFEST-001159"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp1C3EE80361F89B92D09A0D2D0553EC8C" Guid="*">
<File Id="fil0F4EBF2DE7257D8B2AFCE118923ACB0A" KeyPath="yes" Source="$(var.Path)/config/mibs.db/000245.ldb"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp9C1BC4A256489AD28E96CCB71D756F5A" Guid="*">
<File Id="fil48DC518835A19D2E6DB5E73E0308726B" KeyPath="yes" Source="$(var.Path)/config/mibs.db/LOCK"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmpF109BCB55BBB8E84BC05DA868A94BE09" Guid="*">
<File Id="fil7D7CB1218590EA67A22B6DFF5A7CCE28" KeyPath="yes" Source="$(var.Path)/config/mibs.db/LOG"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp515E3506FCE484A129267D75B018F536" Guid="*">
<File Id="filEEB0BCF98E4DFFAE9240831ED138DB66" KeyPath="yes" Source="$(var.Path)/config/mibs.db/CURRENT.bak"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp4533132CE06181C747E10B00B17998B7" Guid="*">
<File Id="fil56C932EDB08B6A60FDBACAF0E13C87B8" KeyPath="yes" Source="$(var.Path)/config/mibs.db/CURRENT"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp065C1B90095E40299FCFD943D5A365B4" Guid="*">
<File Id="filF07790A5F811BA1B0E1DBBCF6EDD563B" KeyPath="yes" Source="$(var.Path)/config/mibs.db/000244.ldb"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp7A74D61B0B6BBDC487C4D7F9BFC1A632" Guid="*">
<File Id="fil3A3ABB8980E3E25E787737AB66F5B9A7" KeyPath="yes" Source="$(var.Path)/config/mibs.db/001158.log"/>
</Component>
</Directory>
<Component Win64="$(var.Win64)" Id="cmp967C1EC7EF35B953CF82064D686B1DB3" Guid="*">
<File Id="fil4E5DE0AAB3EAEE65D8E6062263395519" KeyPath="yes" Source="$(var.Path)/config/udr.csv"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmpA74ADD4DC7268F1F47F5DF814EAB3CED" Guid="*">
<File Id="filB280C66130E94AD7AE4AD936DEDC77CB" KeyPath="yes" Source="$(var.Path)/config/snmp.yaml.sample"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp7EA4396B8D9EC67B7910D8A242FFCF57" Guid="*" NeverOverwrite="yes" Permanent="yes">
<File Id="fil7B0F22EAC1A94EFABD34BAE59BD24184" KeyPath="yes" Source="$(var.Path)/config/snmp-win.yaml">
<util:PermissionEx User="[LogonUser]" GenericAll="yes"/>
</File>
</Component>
<Component Win64="$(var.Win64)" Id="cmpB7CB43E39FFEAC4402F746BD2B4A43D4" Guid="*">
<File Id="filA4569B0E1004D4A52446AD495D2081C9" KeyPath="yes" Source="$(var.Path)/config/GeoLite2-Country.mmdb"/>
</Component>
<Component Win64="$(var.Win64)" Id="cmp34171BB83455309CBC625CC7B8309AD4" Guid="*">
<File Id="filA956FD881F5D992DEC07DA0376CEC92E" KeyPath="yes" Source="$(var.Path)/config/GeoLite2-ASN.mmdb"/>
</Component>
</Directory>
</DirectoryRef>
<!-- Step 3: Tell WiX to install the files -->
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="ktranslate.exe" />
<ComponentRef Id="cmpB46AF4C0CF9C68FA9C458C1219F7C1D1" />
<ComponentRef Id="cmp5DC89FB017DD270B8ABBA3EAEA6CB0D6" />
<ComponentRef Id="cmp010B68C74E1BD336334B89C05B695C7C" />
<ComponentRef Id="cmpE73AD12A4250D0F6EE204100038250B4" />
<ComponentRef Id="cmp1C3EE80361F89B92D09A0D2D0553EC8C" />
<ComponentRef Id="cmp9C1BC4A256489AD28E96CCB71D756F5A" />
<ComponentRef Id="cmpF109BCB55BBB8E84BC05DA868A94BE09" />
<ComponentRef Id="cmp515E3506FCE484A129267D75B018F536" />
<ComponentRef Id="cmp4533132CE06181C747E10B00B17998B7" />
<ComponentRef Id="cmp065C1B90095E40299FCFD943D5A365B4" />
<ComponentRef Id="cmp7A74D61B0B6BBDC487C4D7F9BFC1A632" />
<ComponentRef Id="cmp967C1EC7EF35B953CF82064D686B1DB3" />
<ComponentRef Id="cmpA74ADD4DC7268F1F47F5DF814EAB3CED" />
<ComponentRef Id="cmp7EA4396B8D9EC67B7910D8A242FFCF57" />
<ComponentRef Id="cmpB7CB43E39FFEAC4402F746BD2B4A43D4" />
<ComponentRef Id="cmp34171BB83455309CBC625CC7B8309AD4" />
<!-- Include snmp profiles from SnmpProfiles.wxs fragment-->
<ComponentGroupRef Id="SnmpProfiles" />
</Feature>
<UI Id="WixUI">
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
<!-- Custom Dialogs -->
<!-- Service Type -->
<Dialog Id="ServiceType" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="ServiceTypeRadioButton" Type="RadioButtonGroup" X="45" Y="73" Width="220" Height="38" Property="SERVICE_TYPE">
<RadioButtonGroup Property="SERVICE_TYPE">
<RadioButton Value="snmp" Text="SNMP" X="0" Y="0" Width="220" Height="20"/>
<RadioButton Value="flow" Text="FLOW" X="0" Y="20" Width="220" Height="20"/>
</RadioButtonGroup>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="WelcomeDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="NewDialog" Value="ServiceEnvVariables"><![CDATA[SERVICE_TYPE = "snmp"]]></Publish>
<Publish Event="NewDialog" Value="FlowType"><![CDATA[SERVICE_TYPE = "flow"]]></Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please select service type</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}Service type configuration</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
<Dialog Id="FlowType" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="FlowTypeRadioButton" Type="RadioButtonGroup" X="45" Y="73" Width="220" Height="100" Property="FLOW_TYPE">
<RadioButtonGroup Property="FLOW_TYPE">
<RadioButton Value="sflow" Text="sflow" X="0" Y="0" Width="220" Height="20"/>
<RadioButton Value="netflow5" Text="netflow5" X="0" Y="20" Width="220" Height="20"/>
<RadioButton Value="netflow9" Text="netflow9" X="0" Y="40" Width="220" Height="20"/>
<RadioButton Value="ipfix" Text="ipfix" X="0" Y="60" Width="220" Height="20"/>
</RadioButtonGroup>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="ServiceType">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="NewDialog" Value="ServiceEnvVariables">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please select flow type</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}Please Select flow type</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
<!-- Service Env Variables -->
<Dialog Id="ServiceEnvVariables" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="NewRelicApiKeyLabel" Type="Text" X="45" Y="73" Width="100" Height="15" TabSkip="no" Text="&New Relic Api Key:" />
<Control Id="NewRelicApiKeyEdit" Type="Edit" X="45" Y="85" Width="220" Height="15" Property="NEW_RELIC_API_KEY" />
<Control Id="NrAccountIdLabel" Type="Text" X="45" Y="110" Width="100" Height="15" TabSkip="no" Text="&New Relic Account Id:" />
<Control Id="NrAccountIdEdit" Type="Edit" X="45" Y="122" Width="220" Height="15" Property="NR_ACCOUNT_ID" />
<Control Id="NrRegionLabel" Type="Text" X="45" Y="147" Width="100" Height="15" TabSkip="no" Text="&New Relic Region:" />
<Control Id="NrRegionEdit" Type="Edit" X="45" Y="159" Width="220" Height="15" Property="NR_REGION" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="FlowType"><![CDATA[SERVICE_TYPE = "flow"]]></Publish>
<Publish Event="NewDialog" Value="ServiceType"><![CDATA[SERVICE_TYPE = "snmp"]]></Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please enter your New Relic Api configuration</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}New Relic configuration</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
<Dialog Id="ServiceEnvError" Width="260" Height="85" NoMinimize="yes" Title="[ProductName] Setup">
<Control Id="MyDlgSkipDesc" Type="Text" Width="194" X="48" Y="15" Height="30" Text="All variables are required" />
<Control Id="Ok" Type="PushButton" X="97" Y="57" Width="66" Height="17" Text="Ok" />
</Dialog>
<!-- Dialogs Order Install Mode -->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="ServiceType" Order="2">1</Publish>
<Publish Dialog="ServiceEnvVariables" Control="Next" Event="SpawnDialog" Value="ServiceEnvError" Order="2"><![CDATA[Not (NEW_RELIC_API_KEY <> "" AND NR_ACCOUNT_ID <> "" AND NR_REGION <> "")]]></Publish>
<Publish Dialog="ServiceEnvError" Control="Ok" Event="EndDialog" Value="Return">1</Publish>
</UI>
</Product>
</Wix>