summaryrefslogtreecommitdiff
path: root/tools/x-win
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-04-02 18:56:38 +0200
committerRobin Gareus <robin@gareus.org>2015-04-02 18:56:38 +0200
commita0870f21c1d5281ce7a1dc90dee43882febd82c0 (patch)
treeca3adf37f98ca90dda1fc0e56f1db583a2ff2372 /tools/x-win
parent4d6ac2a8358a05aef7b16519e422e54be3834145 (diff)
windows: run uninstaller on re-install
Diffstat (limited to 'tools/x-win')
-rwxr-xr-xtools/x-win/package.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/x-win/package.sh b/tools/x-win/package.sh
index ecc588b55b..610830f934 100755
--- a/tools/x-win/package.sh
+++ b/tools/x-win/package.sh
@@ -320,6 +320,29 @@ cat >> $NSISFILE << EOF
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
+
+Function .onInit
+
+ ReadRegStr \$R0 HKLM \
+ "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}" \
+ "UninstallString"
+ StrCmp \$R0 "" done
+
+ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
+ "${PROGRAM_NAME} is already installed. \$\\n\$\\nClick 'OK' to remove the \
+ previous version or 'Cancel' to cancel this upgrade." \
+ IDOK uninst
+ Abort
+
+ uninst:
+ ClearErrors
+ Exec \$INSTDIR\uninst.exe ;
+
+ done:
+
+FunctionEnd
+
+
Section "${PROGRAM_NAME}${PROGRAM_VERSION} (required)" SecMainProg
SectionIn RO
SetOutPath \$INSTDIR