diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 16151fd34b..39b3e28ecf 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -6,6 +6,7 @@ !define VERSION "@CPACK_PACKAGE_VERSION@" !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@" !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@" + !define UNINSTALLER_NAME "Uninstall.exe" ;-------------------------------- ;Variables @@ -67,7 +68,7 @@ ; The Inner invocation has written an uninstaller binary for us. ; We need to sign it if it's a production or PR build. !if @PRODUCTION_BUILD@ == 1 - !system '"@SIGNTOOL_EXECUTABLE@" sign /f %HF_PFX_FILE% /p %HF_PFX_PASSPHRASE% /tr http://tsa.starfieldtech.com /td SHA256 $%TEMP%\Uninstall.exe' = 0 + !system '"@SIGNTOOL_EXECUTABLE@" sign /f %HF_PFX_FILE% /p %HF_PFX_PASSPHRASE% /tr http://tsa.starfieldtech.com /td SHA256 $%TEMP%\$UNINSTALLER_NAME' = 0 !endif ; Good. Now we can carry on writing the real installer. @@ -689,7 +690,7 @@ Section "-Core installation" ;Package the signed uninstaller produced by the inner loop !ifndef INNER ; this packages the signed uninstaller - File $%TEMP%\Uninstall.exe + File $%TEMP%\$UNINSTALLER_NAME !endif Push "DisplayName" @@ -702,7 +703,7 @@ Section "-Core installation" Push "@CPACK_PACKAGE_VENDOR@" Call ConditionalAddToRegisty Push "UninstallString" - Push "$INSTDIR\Uninstall.exe" + Push "$INSTDIR\$UNINSTALLER_NAME" Call ConditionalAddToRegisty Push "NoRepair" Push "1" @@ -761,7 +762,7 @@ Section "-Core installation" "$INSTDIR\@CONSOLE_WIN_EXEC_NAME@" ${EndIf} - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\$UNINSTALLER_NAME" ;Read a value from an InstallOptions INI file !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" @@ -937,8 +938,8 @@ Function un.onInit ; so we move it to the $TEMP dir and then execute the copied uninstaller. ${If} $EXEDIR != $TEMP - CopyFiles /SILENT $EXEPATH $TEMP\Uninstall.exe - ExecWait '"$Temp\Uninstall.exe" _?=$INSTDIR' $0 + CopyFiles /SILENT $EXEPATH $TEMP\$UNINSTALLER_NAME + ExecWait '"$Temp\$UNINSTALLER_NAME" _?=$INSTDIR' $0 SetErrorLevel $0 Quit ${EndIf} @@ -1060,7 +1061,7 @@ Section "Uninstall" !endif ;Remove the uninstaller itself. - Delete "$INSTDIR\Uninstall.exe" + Delete "$INSTDIR\$UNINSTALLER_NAME" DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" ;Remove the installation directory if it is empty. @@ -1146,7 +1147,7 @@ Function .onInit ; the installer. This is better than processing a command line option as it means ; this entire code path is not present in the final (real) installer. - WriteUninstaller "$%TEMP%\Uninstall.exe" + WriteUninstaller "$%TEMP%\$UNINSTALLER_NAME" ; just bail out quickly when running the "inner" installer Quit