-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
mosquitto.nsi
163 lines (135 loc) · 5.47 KB
/
mosquitto.nsi
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
; NSIS installer script for mosquitto
!include "MUI2.nsh"
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
; For environment variable code
!include "WinMessages.nsh"
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
Name "mosquitto"
!define VERSION 1.4.90
OutFile "mosquitto-${VERSION}-install-windows-x86.exe"
InstallDir "$PROGRAMFILES\mosquitto"
;--------------------------------
; Installer pages
!insertmacro MUI_PAGE_WELCOME
Page custom DependencyPage
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
;--------------------------------
; Uninstaller pages
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
; Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; Installer sections
Section "Files" SecInstall
SectionIn RO
SetOutPath "$INSTDIR"
File "..\build\src\Release\mosquitto.exe"
File "..\build\src\Release\mosquitto_passwd.exe"
File "..\build\client\Release\mosquitto_pub.exe"
File "..\build\client\Release\mosquitto_sub.exe"
File "..\build\lib\Release\mosquitto.dll"
File "..\build\lib\cpp\Release\mosquittopp.dll"
File "..\aclfile.example"
File "..\ChangeLog.txt"
File "..\mosquitto.conf"
File "..\pwfile.example"
File "..\readme.md"
File "..\readme-windows.txt"
;File "C:\pthreads\Pre-built.2\dll\x86\pthreadVC2.dll"
;File "C:\OpenSSL-Win32\libeay32.dll"
;File "C:\OpenSSL-Win32\ssleay32.dll"
File "..\edl-v10"
File "..\epl-v10"
SetOutPath "$INSTDIR\devel"
File "..\lib\mosquitto.h"
File "..\build\lib\Release\mosquitto.lib"
File "..\lib\cpp\mosquittopp.h"
File "..\build\lib\cpp\Release\mosquittopp.lib"
File "..\src\mosquitto_plugin.h"
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "DisplayName" "Mosquitto MQTT broker"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "HelpLink" "https://mosquitto.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "URLInfoAbout" "https://mosquitto.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "DisplayVersion" "${VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "NoRepair" "1"
WriteRegExpandStr ${env_hklm} MOSQUITTO_DIR $INSTDIR
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
Section "Service" SecService
ExecWait '"$INSTDIR\mosquitto.exe" install'
SectionEnd
Section "Uninstall"
ExecWait '"$INSTDIR\mosquitto.exe" uninstall'
Delete "$INSTDIR\mosquitto.exe"
Delete "$INSTDIR\mosquitto_passwd.exe"
Delete "$INSTDIR\mosquitto_pub.exe"
Delete "$INSTDIR\mosquitto_sub.exe"
Delete "$INSTDIR\mosquitto.dll"
Delete "$INSTDIR\mosquittopp.dll"
Delete "$INSTDIR\aclfile.example"
Delete "$INSTDIR\ChangeLog.txt"
Delete "$INSTDIR\mosquitto.conf"
Delete "$INSTDIR\pwfile.example"
Delete "$INSTDIR\readme.txt"
Delete "$INSTDIR\readme-windows.txt"
;Delete "$INSTDIR\pthreadVC2.dll"
;Delete "$INSTDIR\libeay32.dll"
;Delete "$INSTDIR\ssleay32.dll"
Delete "$INSTDIR\edl-v10"
Delete "$INSTDIR\epl-v10"
Delete "$INSTDIR\devel\mosquitto.h"
Delete "$INSTDIR\devel\mosquitto.lib"
Delete "$INSTDIR\devel\mosquittopp.h"
Delete "$INSTDIR\devel\mosquittopp.lib"
Delete "$INSTDIR\devel\mosquitto_plugin.h"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto"
DeleteRegValue ${env_hklm} MOSQUITTO_DIR
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
LangString DESC_SecInstall ${LANG_ENGLISH} "The main installation."
LangString DESC_SecService ${LANG_ENGLISH} "Install mosquitto as a Windows service?"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecInstall} $(DESC_SecInstall)
!insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Var Dialog
Var OSSLLink
Var PTHLink
Function DependencyPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "OpenSSL - install 'Win32 OpenSSL vXXXXX Light' then copy dlls to the mosquitto directory"
${NSD_CreateLink} 13u 13u 100% 12u "https://slproweb.com/products/Win32OpenSSL.html"
Pop $OSSLLink
${NSD_OnClick} $OSSLLink OnClick_OSSL
${NSD_CreateLabel} 0 26u 100% 12u "pthreads - copy 'pthreadVC2.dll' to the mosquitto directory"
${NSD_CreateLink} 13u 39u 100% 12u "ftp:https://sources.redhat.com/pub/pthreads-win32/dll-latest/dll/x86/"
Pop $PTHLink
${NSD_OnClick} $PTHLink OnClick_PTH
!insertmacro MUI_HEADER_TEXT_PAGE "Dependencies" "This page lists packages that must be installed if not already present"
nsDialogs::Show
FunctionEnd
Function OnClick_OSSL
Pop $0
ExecShell "open" "https://slproweb.com/products/Win32OpenSSL.html"
FunctionEnd
Function OnClick_PTH
Pop $0
ExecShell "open" "ftp:https://sources.redhat.com/pub/pthreads-win32/dll-latest/dll/x86/"
FunctionEnd