From 1b076b92f9a63a3f8216b1cd037df71b6bc03711 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 18 Jul 2011 22:23:13 +0300 Subject: Add uninstall before install to windows installer. --- packaging/windows/setup.nsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'packaging') diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi index 17833ddfc..07e649414 100644 --- a/packaging/windows/setup.nsi +++ b/packaging/windows/setup.nsi @@ -177,6 +177,31 @@ Function .onInit !insertmacro MUI_LANGDLL_DISPLAY InitPluginsDir File /oname=$PLUGINSDIR\setup_finish.bmp "setup_finish.bmp" + + ReadRegStr $R0 HKLM \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "UninstallString" + StrCmp $R0 "" done + + MessageBox MB_YESNO|MB_ICONEXCLAMATION \ + "${PRODUCT_NAME} is already installed. $\n$\nClick `YES` (recomended) to remove the \ + previous version or `NO` to install new version over old version." \ + IDYES uninst + Abort +;Run the uninstaller +uninst: + ClearErrors + ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file + + IfErrors no_remove_uninstaller done + ;You can either use Delete /REBOOTOK in the uninstaller or add some code + ;here to remove the uninstaller. Use a registry key to check + ;whether the user has chosen to uninstall. If you are using an uninstaller + ;components page, make sure all sections are uninstalled. + no_remove_uninstaller: + +done: + FunctionEnd Section "Core files (required)" SecCore -- cgit v1.2.3-60-g2f50