Skip to content
Snippets Groups Projects
Unverified Commit 89c08708 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[pkg] uninstalling dance for old-style nssm installers

parent e05f5aa3
Branches
Tags
1 merge request!94WIP: Feat/windows service
...@@ -46,23 +46,31 @@ RequestExecutionLevel admin ...@@ -46,23 +46,31 @@ RequestExecutionLevel admin
Section "InstallFiles" Section "InstallFiles"
; first we try to delete the helper, in case it is still the nssm-style ; first we try to delete the helper (it can be the old one or a previous version of the new one)
DetailPrint "Trying to uninstall any older helper..."
ClearErrors ClearErrors
Delete 'C:\Program Files\$applicationName\bitmask_helper.exe' Delete 'C:\Program Files\$applicationName\bitmask_helper.exe'
IfErrors 0 noErrorHelper IfErrors 0 noErrorHelper
; this could fail: uninstalling old nssm helper ; uninstalling old nssm helper - could file if it isn't there, or if nssm is not there...
DetailPrint "Trying to uninstall an old style helper..."
ExecShellWait "runas" '"$INSTDIR\nssm.exe" stop $applicationNameLower-helper' ExecShellWait "runas" '"$INSTDIR\nssm.exe" stop $applicationNameLower-helper'
ExecShellWait "runas" '"$INSTDIR\nssm.exe" remove $applicationNameLower-helper confirm' ExecShellWait "runas" '"$INSTDIR\nssm.exe" remove $applicationNameLower-helper confirm'
IfErrors 0 noErrorHelper IfErrors 0 noErrorHelper
; Error handling ; let's try to stop it in case it's the new style helper
DetailPrint "Trying to uninstall a new style helper..."
ExecWait '"$INSTDIR\bitmask_helper.exe" stop'
IfErrors 0 noErrorHelper
; Error handling - ok, we give up
MessageBox MB_OK|MB_ICONEXCLAMATION "$applicationNameLower-helper cannot be deleted. Please try to remove it manually, and then run this installer again." MessageBox MB_OK|MB_ICONEXCLAMATION "$applicationNameLower-helper cannot be deleted. Please try to remove it manually, and then run this installer again."
Abort Abort
noErrorHelper: noErrorHelper:
; now we try to delete the systray, locked by the app. ; now we try to delete the systray, locked by the app - just to know if another instance of FoobarVPN is running.
DetailPrint "Checking for a running systray..."
ClearErrors ClearErrors
Delete 'C:\Program Files\$applicationName\bitmask-vpn.exe' Delete 'C:\Program Files\$applicationName\bitmask-vpn.exe'
IfErrors 0 noError IfErrors 0 noError
...@@ -99,11 +107,21 @@ Section "InstallFiles" ...@@ -99,11 +107,21 @@ Section "InstallFiles"
SectionEnd SectionEnd
Section "InstallService" Section "InstallService"
DetailPrint "Trying to uninstall previous versions of the (new) helper..."
ClearErrors
ExecWait '"$INSTDIR\bitmask_helper.exe" stop'
ExecWait '"$INSTDIR\bitmask_helper.exe" remove'
IfErrors 0 noError
DetailPrint "Could not uninstall a previous version of the (new) helper!"
noError:
ExecWait '"$INSTDIR\bitmask_helper.exe" install' ExecWait '"$INSTDIR\bitmask_helper.exe" install'
ExecWait '"$INSTDIR\bitmask_helper.exe" start' ExecWait '"$INSTDIR\bitmask_helper.exe" start'
SectionEnd SectionEnd
Section /o "TAP Virtual Ethernet Adapter" SecTAP Section /o "TAP Virtual Ethernet Adapter" SecTAP
; TODO bringing the TAP adapter with us might be causing trouble with the fucking A/V mafia.
; we might want to reconsider, and possibly downloading it from official sources...
; Adapted from the windows nsis installer from OpenVPN (openvpn-build repo). ; Adapted from the windows nsis installer from OpenVPN (openvpn-build repo).
DetailPrint "Installing TAP (may need confirmation)..." DetailPrint "Installing TAP (may need confirmation)..."
; The /S flag make it "silent", remove it if you want it explicit ; The /S flag make it "silent", remove it if you want it explicit
...@@ -114,13 +132,14 @@ Section /o "TAP Virtual Ethernet Adapter" SecTAP ...@@ -114,13 +132,14 @@ Section /o "TAP Virtual Ethernet Adapter" SecTAP
SectionEnd SectionEnd
Section "Uninstall" Section "Uninstall"
; we uninstall the new-style go helper ; we uninstall the new-style go helper
ExecShellWait "runas" '"$INSTDIR\bitmask_helper.exe" remove' ExecShellWait "runas" '"$INSTDIR\bitmask_helper.exe" remove'
; now we (try to) remove everything else. kill it with fire!
Delete $INSTDIR\readme.txt Delete $INSTDIR\readme.txt
Delete $INSTDIR\helper.log Delete $INSTDIR\helper.log
Delete $INSTDIR\port
Delete $INSTDIR\nssm.exe
Delete "$SMPROGRAMS\$applicationName\$applicationName.lnk" Delete "$SMPROGRAMS\$applicationName\$applicationName.lnk"
RMDir "$SMPROGRAMS\$applicationName\" RMDir "$SMPROGRAMS\$applicationName\"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment