Skip to content

Commit 211d63f

Browse files
committed
fix(nsis): finally — NSIS Installer Not Working on Second Invocation
Closes #722
1 parent 2e35205 commit 211d63f

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

templates/nsis/installSection.nsh

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,31 @@ ${endif}
2424
${endif}
2525
!endif
2626

27-
ReadRegStr $R0 SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallString
27+
# http://stackoverflow.com/questions/24595887/waiting-for-nsis-uninstaller-to-finish-in-nsis-installer-either-fails-or-the-uni
28+
29+
ReadRegStr $R0 SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallerPath
2830
${if} $R0 != ""
29-
ExecWait "$R0 /S /KEEP_APP_DATA"
31+
ReadRegStr $R1 SHCTX "${INSTALL_REGISTRY_KEY}" InstallLocation
32+
${if} $R1 != ""
33+
CopyFiles /SILENT /FILESONLY "$R0" "$PLUGINSDIR\old-uninstaller.exe"
34+
35+
${if} $installMode == "all"
36+
ExecWait "$PLUGINSDIR\old-uninstaller.exe _?=$R1 /S /KEEP_APP_DATA /allusers"
37+
${Else}
38+
ExecWait "$PLUGINSDIR\old-uninstaller.exe _?=$R1 /S /KEEP_APP_DATA /currentuser"
39+
${endif}
40+
${endif}
3041
${endif}
3142

43+
# remove per-user installation
3244
${if} $installMode == "all"
33-
# remove per-user installation
34-
ReadRegStr $R0 HKEY_CURRENT_USER "${UNINSTALL_REGISTRY_KEY}" UninstallString
45+
ReadRegStr $R0 HKEY_CURRENT_USER "${UNINSTALL_REGISTRY_KEY}" UninstallerPath
3546
${if} $R0 != ""
36-
ExecWait "$R0 /S /KEEP_APP_DATA"
47+
ReadRegStr $R1 HKEY_CURRENT_USER "${INSTALL_REGISTRY_KEY}" InstallLocation
48+
${if} $R1 != ""
49+
CopyFiles /SILENT /FILESONLY "$R0" "$PLUGINSDIR\old-uninstaller.exe"
50+
ExecWait "$PLUGINSDIR\old-uninstaller.exe _?=$R1 /S /KEEP_APP_DATA /currentuser"
51+
${endif}
3752
${endif}
3853
${endif}
3954

@@ -50,12 +65,12 @@ SetCompress "${COMPRESS}"
5065

5166
!ifdef APP_64
5267
${If} ${RunningX64}
53-
Nsis7z::ExtractWithDetails "$PLUGINSDIR\app-64.7z" "Installing %s..."
68+
Nsis7z::Extract "$PLUGINSDIR\app-64.7z"
5469
${Else}
55-
Nsis7z::ExtractWithDetails "$PLUGINSDIR\app-32.7z" "Installing %s..."
70+
Nsis7z::Extract "$PLUGINSDIR\app-32.7z"
5671
${endif}
5772
!else
58-
Nsis7z::ExtractWithDetails "$PLUGINSDIR\app-32.7z" "Installing %s..."
73+
Nsis7z::Extract "$PLUGINSDIR\app-32.7z"
5974
!endif
6075

6176
File "/oname=${UNINSTALL_FILENAME}" "${UNINSTALLER_OUT_FILE}"

templates/nsis/multiUser.nsh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Var installMode
7070
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" DisplayName "${UNINSTALL_DISPLAY_NAME} (only current user)"
7171
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallString '"$INSTDIR\${UNINSTALL_FILENAME}" /currentuser'
7272
${endif}
73+
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallerPath '"$INSTDIR\${UNINSTALL_FILENAME}"'
7374

7475
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
7576
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$appExe,0"

0 commit comments

Comments
 (0)