Skip to content

Commit 1d9ca4d

Browse files
authored
Improve installer (Windows) (netdata#21090)
1 parent 81acfc8 commit 1d9ca4d

File tree

1 file changed

+55
-21
lines changed

1 file changed

+55
-21
lines changed

packaging/windows/netdata.wxs.in

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,41 @@
9797
<WixVariable Id="WixUIDialogBmp" Value="BackGround.bmp" />
9898
<UIRef Id="WixUI_ErrorProgressText" />
9999
<ui:WixUI Id="FeatureTree_ViewLicense" />
100+
101+
<SetProperty
102+
Id="NDKillProcess"
103+
Value="&quot;[WindowsFolder]System32\taskkill.exe&quot; /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="&quot;[WindowsFolder]System32\sc.exe&quot; failureflag &quot;netdata&quot; 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>
100135
</Package>
101136

102137
<Fragment>
@@ -190,12 +225,6 @@
190225
<Custom Action="InstallManifest" After="InstallFiles" />
191226
</InstallExecuteSequence>
192227

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-
199228
<Component Id="NetdataService" Directory="USRBINDIR">
200229
<File Id="netdata.exe" Source="C:\msys64\opt\netdata\usr\bin\netdata.exe" KeyPath="yes" />
201230

@@ -204,22 +233,27 @@
204233
DisplayName="Netdata Agent"
205234
Description="Distributed, real-time, performance and health monitoring for systems and applications."
206235
Type="ownProcess"
236+
Interactive="no"
207237
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" />
223257
</Component>
224258
</Fragment>
225259

0 commit comments

Comments
 (0)