windows installer fixes
This commit is contained in:
@@ -105,6 +105,14 @@ FunctionEnd
|
||||
|
||||
Section "Install"
|
||||
SetShellVarContext all
|
||||
|
||||
# Terminate any existing service or running processes before replacing files
|
||||
ExecWait 'net stop LOGAR_Client'
|
||||
ExecWait 'sc stop LOGAR_Client'
|
||||
ExecWait 'taskkill /F /T /IM Win_Client.exe'
|
||||
ExecWait 'taskkill /F /T /IM nssm.exe'
|
||||
Sleep 500
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
File "../dist/Win_Client.exe"
|
||||
File "../compilation/nssm.exe"
|
||||
@@ -138,9 +146,22 @@ Section "Uninstall"
|
||||
StrCpy $DATADIR "$APPDATA\LOGAR"
|
||||
${EndIf}
|
||||
|
||||
ExecWait '"$INSTDIR\nssm.exe" stop LOGAR_Client'
|
||||
ExecWait '"$INSTDIR\nssm.exe" remove LOGAR_Client confirm'
|
||||
Sleep 500
|
||||
# 1. Stop and remove service
|
||||
ExecWait 'net stop LOGAR_Client'
|
||||
ExecWait 'sc stop LOGAR_Client'
|
||||
${If} ${FileExists} "$INSTDIR\nssm.exe"
|
||||
ExecWait '"$INSTDIR\nssm.exe" stop LOGAR_Client'
|
||||
ExecWait '"$INSTDIR\nssm.exe" remove LOGAR_Client confirm'
|
||||
${EndIf}
|
||||
ExecWait 'sc delete LOGAR_Client'
|
||||
|
||||
# 2. Force terminate any lingering processes
|
||||
ExecWait 'taskkill /F /T /IM Win_Client.exe'
|
||||
ExecWait 'taskkill /F /T /IM nssm.exe'
|
||||
ExecWait 'powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "Get-CimInstance Win32_Process | Where-Object { $$_.ExecutablePath -like ''$INSTDIR\*'' } | ForEach-Object { Stop-Process -Id $$_.ProcessId -Force -ErrorAction SilentlyContinue }"'
|
||||
Sleep 1200
|
||||
|
||||
# 3. Clean up all installation and data files
|
||||
RMDir /r "$INSTDIR\runtime"
|
||||
RMDir /r "$INSTDIR\certs"
|
||||
Delete "$INSTDIR\client_config.json"
|
||||
@@ -152,4 +173,5 @@ Section "Uninstall"
|
||||
RMDir /r "$INSTDIR"
|
||||
RMDir /r "$DATADIR"
|
||||
DeleteRegKey HKLM "Software\LOGAR\LOGAR-Client"
|
||||
DeleteRegKey /ifempty HKLM "Software\LOGAR"
|
||||
SectionEnd
|
||||
|
||||
Reference in New Issue
Block a user