diff options
| author | Odd Stranne <odd@mullvad.net> | 2018-05-03 14:34:37 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-06-08 11:13:02 +0200 |
| commit | 019649596e6831b9fe308a36f6c067f882d3c215 (patch) | |
| tree | 0346c8a9e1c51de85ef7e756324d79a562fad718 | |
| parent | 0ae7d0cfe32a6892774a5487afa8f8a040ae4581 (diff) | |
| download | mullvadvpn-019649596e6831b9fe308a36f6c067f882d3c215.tar.xz mullvadvpn-019649596e6831b9fe308a36f6c067f882d3c215.zip | |
Improve service installation and related error checking
| -rw-r--r-- | dist-assets/installer.nsh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/dist-assets/installer.nsh b/dist-assets/installer.nsh index 0a0e7300da..20f1aa5ea4 100644 --- a/dist-assets/installer.nsh +++ b/dist-assets/installer.nsh @@ -14,6 +14,10 @@ # TAP device hardware ID !define TapHardwareId "tap0901" +# "sc" exit code +!define SERVICE_STARTED 0 +!define SERVICE_START_PENDING 2 + # # BreakInstallation # @@ -144,6 +148,12 @@ Push $0 Push $1 + nsExec::ExecToStack '"sc.exe" delete mullvadvpn' + + # Discard return value + # The service may have not been installed previously + Pop $0 + nsExec::ExecToStack '"$INSTDIR\resources\mullvad-daemon.exe" --register-service' Pop $0 @@ -154,12 +164,13 @@ Goto InstallService_return ${EndIf} - nsExec::ExecToStack 'net start mullvad' + nsExec::ExecToStack '"sc.exe" start mullvadvpn' Pop $0 Pop $1 - ${If} $0 != 0 + ${If} $0 != ${SERVICE_STARTED} + ${AndIf} $0 != ${SERVICE_START_PENDING} StrCpy $R0 "Failed to start Mullvad service" Goto InstallService_return ${EndIf} |
