diff --git a/templates/nsis/installSection.nsh b/templates/nsis/installSection.nsh index 1667e6295b8..d75c1c70bdb 100644 --- a/templates/nsis/installSection.nsh +++ b/templates/nsis/installSection.nsh @@ -24,16 +24,31 @@ ${endif} ${endif} !endif -ReadRegStr $R0 SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallString +# http://stackoverflow.com/questions/24595887/waiting-for-nsis-uninstaller-to-finish-in-nsis-installer-either-fails-or-the-uni + +ReadRegStr $R0 SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallerPath ${if} $R0 != "" - ExecWait "$R0 /S /KEEP_APP_DATA" + ReadRegStr $R1 SHCTX "${INSTALL_REGISTRY_KEY}" InstallLocation + ${if} $R1 != "" + CopyFiles /SILENT /FILESONLY "$R0" "$PLUGINSDIR\old-uninstaller.exe" + + ${if} $installMode == "all" + ExecWait "$PLUGINSDIR\old-uninstaller.exe _?=$R1 /S /KEEP_APP_DATA /allusers" + ${Else} + ExecWait "$PLUGINSDIR\old-uninstaller.exe _?=$R1 /S /KEEP_APP_DATA /currentuser" + ${endif} + ${endif} ${endif} +# remove per-user installation ${if} $installMode == "all" - # remove per-user installation - ReadRegStr $R0 HKEY_CURRENT_USER "${UNINSTALL_REGISTRY_KEY}" UninstallString + ReadRegStr $R0 HKEY_CURRENT_USER "${UNINSTALL_REGISTRY_KEY}" UninstallerPath ${if} $R0 != "" - ExecWait "$R0 /S /KEEP_APP_DATA" + ReadRegStr $R1 HKEY_CURRENT_USER "${INSTALL_REGISTRY_KEY}" InstallLocation + ${if} $R1 != "" + CopyFiles /SILENT /FILESONLY "$R0" "$PLUGINSDIR\old-uninstaller.exe" + ExecWait "$PLUGINSDIR\old-uninstaller.exe _?=$R1 /S /KEEP_APP_DATA /currentuser" + ${endif} ${endif} ${endif} @@ -50,12 +65,12 @@ SetCompress "${COMPRESS}" !ifdef APP_64 ${If} ${RunningX64} - Nsis7z::ExtractWithDetails "$PLUGINSDIR\app-64.7z" "Installing %s..." + Nsis7z::Extract "$PLUGINSDIR\app-64.7z" ${Else} - Nsis7z::ExtractWithDetails "$PLUGINSDIR\app-32.7z" "Installing %s..." + Nsis7z::Extract "$PLUGINSDIR\app-32.7z" ${endif} !else - Nsis7z::ExtractWithDetails "$PLUGINSDIR\app-32.7z" "Installing %s..." + Nsis7z::Extract "$PLUGINSDIR\app-32.7z" !endif File "/oname=${UNINSTALL_FILENAME}" "${UNINSTALLER_OUT_FILE}" diff --git a/templates/nsis/multiUser.nsh b/templates/nsis/multiUser.nsh index bee6078e0a9..c61bb470dac 100644 --- a/templates/nsis/multiUser.nsh +++ b/templates/nsis/multiUser.nsh @@ -70,6 +70,7 @@ Var installMode WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" DisplayName "${UNINSTALL_DISPLAY_NAME} (only current user)" WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallString '"$INSTDIR\${UNINSTALL_FILENAME}" /currentuser' ${endif} + WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallerPath '"$INSTDIR\${UNINSTALL_FILENAME}"' WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${VERSION}" WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$appExe,0"