mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
[desktop] Windows Installer: stop service (when running) before install
This commit is contained in:
parent
27235ad7b7
commit
af4035feda
1 changed files with 15 additions and 4 deletions
|
@ -6,14 +6,25 @@ var oldInstallationDir
|
||||||
var dataDir
|
var dataDir
|
||||||
|
|
||||||
!macro NSIS_HOOK_PREINSTALL
|
!macro NSIS_HOOK_PREINSTALL
|
||||||
; Abort if old service is running
|
; Try to stop the service if it's running
|
||||||
SimpleSC::ServiceIsStopped "PortmasterCore"
|
SimpleSC::ServiceIsStopped "PortmasterCore"
|
||||||
Pop $0
|
Pop $0
|
||||||
Pop $1
|
Pop $1
|
||||||
${If} $0 == 0
|
${If} $0 == 0
|
||||||
${If} $1 == 0
|
${If} $1 == 0
|
||||||
MessageBox MB_OK "Portmaster service is running. Stop it and run the installer again."
|
|
||||||
Abort
|
DetailPrint "PortmasterCore service is running. Stopping service ..."
|
||||||
|
SimpleSC::StopService "PortmasterCore" 1 60
|
||||||
|
Pop $0
|
||||||
|
${If} $0 != 0
|
||||||
|
DetailPrint "Failed to stop PortmasterCore service. Error: $0"
|
||||||
|
MessageBox MB_OK "PortmasterCore service is running. Stop it and run the installer again."
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
; wait a little (give change for service to fully stop)
|
||||||
|
Sleep 2000
|
||||||
|
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
@ -125,7 +136,7 @@ var dataDir
|
||||||
!macro NSIS_HOOK_PREUNINSTALL
|
!macro NSIS_HOOK_PREUNINSTALL
|
||||||
DetailPrint "Stopping service"
|
DetailPrint "Stopping service"
|
||||||
; Trigger service stop. In the worst case the service should stop in ~60 seconds.
|
; Trigger service stop. In the worst case the service should stop in ~60 seconds.
|
||||||
SimpleSC::StopService "PortmasterCore" 1 90
|
SimpleSC::StopService "PortmasterCore" 1 60
|
||||||
Pop $0
|
Pop $0
|
||||||
${If} $0 != 0
|
${If} $0 != 0
|
||||||
DetailPrint "Failed to stop PortmasterCore service. Error: $0"
|
DetailPrint "Failed to stop PortmasterCore service. Error: $0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue