Improve installer (Windows) (#21090)
thiagoftsm committed
Oct 3, 2025 at 11:50 UTC
1d9ca4d185c54ff72e0fa2fcc44bcaa0f7ffb4e3
1 file changed
+55
-21
packaging/windows/netdata.wxs.in
+55
-21
@@ -97,6 +97,41 @@
97
<WixVariable Id="WixUIDialogBmp" Value="BackGround.bmp" />
98
<UIRef Id="WixUI_ErrorProgressText" />
99
<ui:WixUI Id="FeatureTree_ViewLicense" />
100
+
101
+ <SetProperty
102
+ Id="NDKillProcess"
103
+ Value=""[WindowsFolder]System32\taskkill.exe" /T /F /IM netdata.exe"
104
+ Before="NDKillProcess"
105
+ Sequence="execute"
106
+ />
107
+ <CustomAction
108
+ Id="NDKillProcess"
109
+ BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
110
+ DllEntry="WixQuietExec"
111
+ Execute="deferred"
112
+ Return="ignore"
113
+ Impersonate="no"
114
+ />
115
+
116
+ <SetProperty
117
+ Id="NDConfigureServiceRecovery"
118
+ Value=""[WindowsFolder]System32\sc.exe" failureflag "netdata" 1"
119
+ Before="NDConfigureServiceRecovery"
120
+ Sequence="execute"
121
+ />
122
+ <CustomAction
123
+ Id="NDConfigureServiceRecovery"
124
+ BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
125
+ DllEntry="WixQuietExec"
126
+ Execute="deferred"
127
+ Return="ignore"
128
+ Impersonate="no"
129
+ />
130
+
131
+ <InstallExecuteSequence>
132
+ <Custom Action="NDConfigureServiceRecovery" After="InstallServices" Condition="NOT REMOVE" />
133
+ <Custom Action="NDKillProcess" Before="RemoveFiles" />
134
+ </InstallExecuteSequence>
135
</Package>
136
137
<Fragment>
@@ -190,12 +225,6 @@
225
<Custom Action="InstallManifest" After="InstallFiles" />
226
</InstallExecuteSequence>
227
193
- <!-- Added StopNetdataService custom action to ensure service is stopped before file operations -->
194
- <CustomAction Id="StopNetdataService" Directory="System64Folder" ExeCommand='net stop Netdata' Execute="immediate" Return="ignore" />
195
- <InstallExecuteSequence>
196
- <Custom Action="StopNetdataService" Before="InstallValidate" Condition="Installed AND NOT REMOVE" />
197
- </InstallExecuteSequence>
198
-
228
<Component Id="NetdataService" Directory="USRBINDIR">
229
<File Id="netdata.exe" Source="C:\msys64\opt\netdata\usr\bin\netdata.exe" KeyPath="yes" />
230
@@ -204,22 +233,27 @@
233
DisplayName="Netdata Agent"
234
Description="Distributed, real-time, performance and health monitoring for systems and applications."
235
Type="ownProcess"
236
+ Interactive="no"
237
Start="auto"
208
- ErrorControl="normal" />
209
-
210
- <!-- Modified to ensure proper service handling during update -->
211
- <ServiceControl Id="ControlService"
212
- Name="Netdata"
213
- Stop="both"
214
- Start="install"
215
- Remove="uninstall"
216
- Wait="yes" />
217
-
218
- <RegistryValue Root="HKLM"
219
- Key="System\CurrentControlSet\Services\Netdata"
220
- Name="DelayedAutoStart"
221
- Value="1"
222
- Type="integer" />
238
+ ErrorControl="normal"
239
+ Vital="yes">
240
+
241
+ <ServiceConfig
242
+ DelayedAutoStart="yes"
243
+ OnInstall="yes"
244
+ OnReinstall="yes" />
245
+
246
+ <util:ServiceConfig
247
+ ResetPeriodInDays="0"
248
+ FirstFailureActionType="restart"
249
+ SecondFailureActionType="restart"
250
+ ThirdFailureActionType="restart"
251
+ RestartServiceDelayInSeconds="60"
252
+ />
253
+ </ServiceInstall>
254
+
255
+ <ServiceControl Id="StartService" Name="Netdata" Start="install" Wait="no" />
256
+ <ServiceControl Id="StopService" Name="Netdata" Remove="uninstall" Stop="both" Wait="yes" />
257
</Component>
258
</Fragment>
259