blob: c14ccb599368ef89297bd53f5fa9f98561f26ff2 (
plain)
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
|
!include "MUI2.nsh"
!include "nsDialogs.nsh"
!include "FileFunc.nsh"
Name "Netdata"
Outfile "netdata-installer.exe"
InstallDir "$PROGRAMFILES\Netdata"
RequestExecutionLevel admin
!define MUI_ICON "NetdataWhite.ico"
!define MUI_UNICON "NetdataWhite.ico"
!define ND_UININSTALL_REG "Software\Microsoft\Windows\CurrentVersion\Uninstall\Netdata"
!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "C:\msys64\gpl-3.0.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Function .onInit
nsExec::ExecToLog '$SYSDIR\sc.exe stop Netdata'
pop $0
${If} $0 == 0
nsExec::ExecToLog '$SYSDIR\sc.exe delete Netdata'
pop $0
${EndIf}
FunctionEnd
Function NetdataUninstallRegistry
ClearErrors
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"DisplayName" "Netdata - Real-time system monitoring."
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"DisplayIcon" "$INSTDIR\Uninstall.exe,0"
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"RegOwner" "Netdata Inc."
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"RegCompany" "Netdata Inc."
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"Publisher" "Netdata Inc."
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"HelpLink" "https://learn.netdata.cloud/"
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"URLInfoAbout" "https://www.netdata.cloud/"
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"DisplayVersion" "${CURRVERSION}"
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"VersionMajor" "${MAJORVERSION}"
WriteRegStr HKLM "${ND_UININSTALL_REG}" \
"VersionMinor" "${MINORVERSION}"
IfErrors 0 +2
MessageBox MB_ICONEXCLAMATION|MB_OK "Unable to create an entry in the Control Panel!" IDOK end
ClearErrors
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${ND_UININSTALL_REG}" "EstimatedSize" "$0"
IfErrors 0 +2
MessageBox MB_ICONEXCLAMATION|MB_OK "Cannot estimate the installation size." IDOK end
end:
FunctionEnd
Section "Install Netdata"
SetOutPath $INSTDIR
SetCompress off
File /r "C:\msys64\opt\netdata\*.*"
ClearErrors
nsExec::ExecToLog '$SYSDIR\sc.exe create Netdata binPath= "$INSTDIR\usr\bin\netdata.exe" start= delayed-auto'
pop $0
${If} $0 != 0
DetailPrint "Warning: Failed to create Netdata service."
${EndIf}
ClearErrors
nsExec::ExecToLog '$SYSDIR\sc.exe description Netdata "Real-time system monitoring service"'
pop $0
${If} $0 != 0
DetailPrint "Warning: Failed to add Netdata service description."
${EndIf}
ClearErrors
nsExec::ExecToLog '$SYSDIR\sc.exe start Netdata'
pop $0
${If} $0 != 0
DetailPrint "Warning: Failed to start Netdata service."
${EndIf}
WriteUninstaller "$INSTDIR\Uninstall.exe"
Call NetdataUninstallRegistry
SectionEnd
Section "Uninstall"
ClearErrors
nsExec::ExecToLog '$SYSDIR\sc.exe stop Netdata'
pop $0
${If} $0 != 0
DetailPrint "Warning: Failed to stop Netdata service."
${EndIf}
ClearErrors
nsExec::ExecToLog '$SYSDIR\sc.exe delete Netdata'
pop $0
${If} $0 != 0
DetailPrint "Warning: Failed to delete Netdata service."
${EndIf}
RMDir /r "$INSTDIR"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Netdata"
SectionEnd
|