Skip to content

Commit

Permalink
Windows: Installer quality of life improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed May 24, 2024
1 parent 3d4bac0 commit 0881024
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Broker:
Clients:
- Fix mosquitto_rr not honouring `-R`. Closes #2893.

Windows:
- Installer will start/stop the mosquitto service when installing and
uninstalling, to prevent problems with not being able to overwrite or remove
mosquitto.exe.


2.0.17 - 2023-08-22
===================
Expand Down
12 changes: 12 additions & 0 deletions installer/mosquitto.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ InstallDir "$PROGRAMFILES\mosquitto"

Section "Files" SecInstall
SectionIn RO

ExecWait 'sc stop mosquitto'
Sleep 1000

SetOutPath "$INSTDIR"
File "..\logo\mosquitto.ico"
File "..\build\src\Release\mosquitto.exe"
File "..\build\apps\mosquitto_passwd\Release\mosquitto_passwd.exe"
File "..\build\apps\mosquitto_ctrl\Release\mosquitto_ctrl.exe"
Expand Down Expand Up @@ -75,6 +80,7 @@ Section "Files" SecInstall

WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "DisplayName" "Eclipse Mosquitto MQTT broker"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "DisplayIcon" "$INSTDIR\mosquitto.ico"
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/"
Expand All @@ -89,10 +95,15 @@ SectionEnd

Section "Service" SecService
ExecWait '"$INSTDIR\mosquitto.exe" install'
ExecWait 'sc start mosquitto'
SectionEnd

Section "Uninstall"
ExecWait 'sc stop mosquitto'
Sleep 1000
ExecWait '"$INSTDIR\mosquitto.exe" uninstall'
Sleep 1000

Delete "$INSTDIR\mosquitto.exe"
Delete "$INSTDIR\mosquitto_ctrl.exe"
Delete "$INSTDIR\mosquitto_passwd.exe"
Expand All @@ -114,6 +125,7 @@ Section "Uninstall"
Delete "$INSTDIR\libcrypto-1_1.dll"
Delete "$INSTDIR\edl-v10"
Delete "$INSTDIR\epl-v20"
Delete "$INSTDIR\mosquitto.ico"

Delete "$INSTDIR\devel\mosquitto.h"
Delete "$INSTDIR\devel\mosquitto.lib"
Expand Down
12 changes: 12 additions & 0 deletions installer/mosquitto64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ InstallDir "$PROGRAMFILES64\mosquitto"

Section "Files" SecInstall
SectionIn RO

ExecWait 'sc stop mosquitto'
Sleep 1000

SetOutPath "$INSTDIR"
File "..\logo\mosquitto.ico"
File "..\build64\src\Release\mosquitto.exe"
File "..\build64\apps\mosquitto_ctrl\Release\mosquitto_ctrl.exe"
File "..\build64\apps\mosquitto_passwd\Release\mosquitto_passwd.exe"
Expand Down Expand Up @@ -81,6 +86,7 @@ Section "Files" SecInstall

WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "DisplayName" "Eclipse Mosquitto MQTT broker (64 bit)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "DisplayIcon" "$INSTDIR\mosquitto.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "HelpLink" "https://mosquitto.org/"
Expand All @@ -102,10 +108,15 @@ SectionEnd

Section "Service" SecService
ExecWait '"$INSTDIR\mosquitto.exe" install'
ExecWait 'sc start mosquitto'
SectionEnd

Section "Uninstall"
ExecWait 'sc stop mosquitto'
Sleep 1000
ExecWait '"$INSTDIR\mosquitto.exe" uninstall'
Sleep 1000

Delete "$INSTDIR\mosquitto.dll"
Delete "$INSTDIR\mosquitto.exe"
Delete "$INSTDIR\mosquitto_ctrl.exe"
Expand All @@ -126,6 +137,7 @@ Section "Uninstall"
Delete "$INSTDIR\SECURITY.md"
Delete "$INSTDIR\edl-v10"
Delete "$INSTDIR\epl-v20"
Delete "$INSTDIR\mosquitto.ico"

Delete "$INSTDIR\cjson.dll"
Delete "$INSTDIR\libcrypto-3-x64.dll"
Expand Down

0 comments on commit 0881024

Please sign in to comment.