From f855feff7b99a94f23a1a72eecbd6fc3282f8624 Mon Sep 17 00:00:00 2001 From: mlsmaycon Date: Mon, 23 May 2022 22:56:43 +0200 Subject: [PATCH] Use current user in context and launch app after install [skip ci] --- client/installer.nsis | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/client/installer.nsis b/client/installer.nsis index 3036cbe3d..5c87006ee 100644 --- a/client/installer.nsis +++ b/client/installer.nsis @@ -119,11 +119,12 @@ Sleep 1000 SectionEnd ###################################################################### -Function .onInit +; The "" makes the section hidden. +Section "" SecUninstallPrevious - Exec $INSTDIR\netbird_uninstall.exe + Call UninstallPrevious -FunctionEnd +SectionEnd ###################################################################### Section Uninstall @@ -146,4 +147,25 @@ Function LaunchLink SetShellVarContext current ExecShell "" "$DESKTOP\${UI_APP_NAME}.lnk" SetShellVarContext all +FunctionEnd + + + + +Function UninstallPrevious + + ; Check for uninstaller. + ReadRegStr $R0 HKLM "${HKLM_REG_KEY}" "InstallDir" + + ${If} $R0 == "" + Goto Done + ${EndIf} + + DetailPrint "Removing previous installation." + + ; Run the uninstaller silently. + ExecWait '"$R0\netbird_uninstall.exe /S"' + + Done: + FunctionEnd \ No newline at end of file