summaryrefslogtreecommitdiffstats
path: root/config/cmake/NSIS.template.in
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2014-01-07 20:02:21 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2014-01-07 20:02:21 (GMT)
commitd8b13f60ff7caf7df95f820b494e3f5e41a69be5 (patch)
treec57541fd47e9384f7023fdad6cd9356218998ed7 /config/cmake/NSIS.template.in
parentf30276c46272e6a0187f3920a2d545fde8034386 (diff)
downloadhdf5-d8b13f60ff7caf7df95f820b494e3f5e41a69be5.zip
hdf5-d8b13f60ff7caf7df95f820b494e3f5e41a69be5.tar.gz
hdf5-d8b13f60ff7caf7df95f820b494e3f5e41a69be5.tar.bz2
[svn-r24621] Update files for changes to installation vars on windows.
Diffstat (limited to 'config/cmake/NSIS.template.in')
-rw-r--r--config/cmake/NSIS.template.in234
1 files changed, 130 insertions, 104 deletions
diff --git a/config/cmake/NSIS.template.in b/config/cmake/NSIS.template.in
index f28db0f..59a444b 100644
--- a/config/cmake/NSIS.template.in
+++ b/config/cmake/NSIS.template.in
@@ -25,7 +25,7 @@
!include "MUI.nsh"
;Default installation folder
- InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+ InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
;--------------------------------
;General
@@ -37,7 +37,10 @@
;Set compression
SetCompressor @CPACK_NSIS_COMPRESSOR@
-@CPACK_NSIS_DEFINES@
+ ;Require administrator access
+ RequestExecutionLevel admin
+
+@CPACK_NSIS_DEFINES@
!include Sections.nsh
@@ -71,10 +74,10 @@ Var AR_RegFlags
; This macro reads component installed flag from the registry and
;changes checked state of the section on the components page.
;Input: section index constant name specified in Section command.
-
+
ClearErrors
;Reading component status from registry
- ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" "Installed"
+ ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
IfErrors "default_${SecName}"
;Status will stay default if registry value not found
;(component was never installed)
@@ -86,20 +89,20 @@ Var AR_RegFlags
; Note whether this component was installed before
!insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
IntOp $R0 $AR_RegFlags & $AR_RegFlags
-
+
;Writing modified flags
SectionSetFlags ${${SecName}} $AR_SecFlags
-
+
"default_${SecName}:"
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
!macroend
-
+
!macro FinishSection SecName
; This macro reads section flag set by user and removes the section
;if it is not selected.
;Then it writes component installed flag to registry
;Input: section index constant name specified in Section command.
-
+
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
;Checking lowest bit:
IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
@@ -107,23 +110,23 @@ Var AR_RegFlags
;Section is not selected:
;Calling Section uninstall macro and writing zero installed flag
!insertmacro "Remove_${${SecName}}"
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
"Installed" 0
Goto "exit_${SecName}"
-
+
"leave_${SecName}:"
;Section is selected:
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
"Installed" 1
-
+
"exit_${SecName}:"
!macroend
-
-!macro RemoveSection SecName
+
+!macro RemoveSection_CPack SecName
; This macro is used to call section's Remove_... macro
;from the uninstaller.
;Input: section index constant name specified in Section command.
-
+
!insertmacro "Remove_${${SecName}}"
!macroend
@@ -132,18 +135,18 @@ Var AR_RegFlags
!insertmacro LoadVar ${SecName}_selected
SectionGetFlags ${${SecName}} $R1
IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
-
+
; See if the status has changed:
IntCmp $R0 $R1 "${SecName}_unchanged"
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
-
+
IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
!insertmacro "Deselect_required_by_${SecName}"
goto "${SecName}_unchanged"
-
+
"${SecName}_was_selected:"
!insertmacro "Select_${SecName}_depends"
-
+
"${SecName}_unchanged:"
!macroend
;--- End of Add/Remove macros ---
@@ -153,7 +156,7 @@ Var AR_RegFlags
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
-
+
;--------------------------------
; path functions
@@ -168,7 +171,7 @@ Var AR_RegFlags
!include "WinMessages.NSH"
!verbose 4
;====================================================
-; get_NT_environment
+; get_NT_environment
; Returns: the selected environment
; Output : head of the stack
;====================================================
@@ -198,22 +201,22 @@ FunctionEnd
!define WriteEnvStr_RegKey 'HKCU "Environment"'
!endif
!endif
-
+
; AddToPath - Adds the given dir to the search path.
; Input - head of the stack
; Note - Win9x systems requires reboot
-
+
Function AddToPath
Exch $0
Push $1
Push $2
Push $3
-
+
# don't add if the path doesn't exist
IfFileExists "$0\*.*" "" AddToPath_done
-
+
ReadEnvStr $1 PATH
- ; if the path is too long for a NSIS variable NSIS will return a 0
+ ; if the path is too long for a NSIS variable NSIS will return a 0
; length string. If we find that, then warn and skip any path
; modification as it will trash the existing path.
StrLen $2 $1
@@ -243,7 +246,7 @@ Function AddToPath
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
-
+
Call IsNT
Pop $1
StrCmp $1 1 AddToPath_NT
@@ -258,7 +261,7 @@ Function AddToPath
FileClose $1
SetRebootFlag true
Goto AddToPath_done
-
+
AddToPath_NT:
StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
ReadRegStr $1 ${NT_current_env} "PATH"
@@ -279,7 +282,7 @@ Function AddToPath
WriteRegExpandStr ${NT_all_env} "PATH" $0
DoSend:
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
+
AddToPath_done:
Pop $3
Pop $2
@@ -287,10 +290,10 @@ Function AddToPath
Pop $0
FunctionEnd
-
+
; RemoveFromPath - Remove a given dir from the path
; Input: head of the stack
-
+
Function un.RemoveFromPath
Exch $0
Push $1
@@ -299,9 +302,9 @@ Function un.RemoveFromPath
Push $4
Push $5
Push $6
-
+
IntFmt $6 "%c" 26 # DOS EOF
-
+
Call un.IsNT
Pop $1
StrCmp $1 1 unRemoveFromPath_NT
@@ -313,7 +316,7 @@ Function un.RemoveFromPath
GetFullPathName /SHORT $0 $0
StrCpy $0 "SET PATH=%PATH%;$0"
Goto unRemoveFromPath_dosLoop
-
+
unRemoveFromPath_dosLoop:
FileRead $1 $3
StrCpy $5 $3 1 -1 # read last char
@@ -328,7 +331,7 @@ Function un.RemoveFromPath
unRemoveFromPath_dosLoopRemoveLine:
SetRebootFlag true
Goto unRemoveFromPath_dosLoop
-
+
unRemoveFromPath_dosLoopEnd:
FileClose $2
FileClose $1
@@ -337,7 +340,7 @@ Function un.RemoveFromPath
CopyFiles /SILENT $4 "$1\autoexec.bat"
Delete $4
Goto unRemoveFromPath_done
-
+
unRemoveFromPath_NT:
StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
ReadRegStr $1 ${NT_current_env} "PATH"
@@ -361,11 +364,11 @@ Function un.RemoveFromPath
StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
StrCpy $3 $5$6
-
+
StrCpy $5 $3 1 -1 # copy last char
StrCmp $5 ";" 0 +2 # if last char == ;
StrCpy $3 $3 -1 # remove last char
-
+
StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
WriteRegExpandStr ${NT_current_env} "PATH" $3
Goto unDoSend
@@ -373,7 +376,7 @@ Function un.RemoveFromPath
WriteRegExpandStr ${NT_all_env} "PATH" $3
unDoSend:
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
+
unRemoveFromPath_done:
Pop $6
Pop $5
@@ -383,7 +386,7 @@ Function un.RemoveFromPath
Pop $1
Pop $0
FunctionEnd
-
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Uninstall sutff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -391,7 +394,7 @@ FunctionEnd
###########################################
# Utility Functions #
###########################################
-
+
;====================================================
; IsNT - Returns 1 if the current system is NT, 0
; otherwise.
@@ -405,7 +408,7 @@ FunctionEnd
; Call IsNT
; Pop $R0
; ($R0 at this point is 1 or 0)
-
+
!macro IsNT un
Function ${un}IsNT
Push $0
@@ -415,7 +418,7 @@ Function ${un}IsNT
Pop $0
Push 0
Return
-
+
IsNT_yes:
; NT!!!
Pop $0
@@ -424,7 +427,7 @@ FunctionEnd
!macroend
!insertmacro IsNT ""
!insertmacro IsNT "un."
-
+
; StrStr
; input, top of stack = string to search for
; top of stack-1 = string to search in
@@ -437,7 +440,7 @@ FunctionEnd
; Call StrStr
; Pop $R0
; ($R0 at this point is "ass string")
-
+
!macro StrStr un
Function ${un}StrStr
Exch $R1 ; st=haystack,old$R1, $R1=needle
@@ -472,28 +475,28 @@ FunctionEnd
!insertmacro StrStr "un."
Function Trim ; Added by Pelaca
- Exch $R1
- Push $R2
+ Exch $R1
+ Push $R2
Loop:
- StrCpy $R2 "$R1" 1 -1
- StrCmp "$R2" " " RTrim
- StrCmp "$R2" "$\n" RTrim
- StrCmp "$R2" "$\r" RTrim
- StrCmp "$R2" ";" RTrim
- GoTo Done
-RTrim:
- StrCpy $R1 "$R1" -1
- Goto Loop
+ StrCpy $R2 "$R1" 1 -1
+ StrCmp "$R2" " " RTrim
+ StrCmp "$R2" "$\n" RTrim
+ StrCmp "$R2" "$\r" RTrim
+ StrCmp "$R2" ";" RTrim
+ GoTo Done
+RTrim:
+ StrCpy $R1 "$R1" -1
+ Goto Loop
Done:
- Pop $R2
- Exch $R1
+ Pop $R2
+ Exch $R1
FunctionEnd
Function ConditionalAddToRegisty
Pop $0
Pop $1
StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
- WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" \
+ WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
"$1" "$0"
;MessageBox MB_OK "Set Registry: '$1' to '$0'"
DetailPrint "Set install registry entry: '$1' to '$0'"
@@ -516,7 +519,7 @@ Function DownloadFile
try_again:
NSISdl::download "$1/$0" "$INSTDIR\$0"
-
+
Pop $1
StrCmp $1 "success" success
StrCmp $1 "Cancelled" cancel
@@ -549,10 +552,10 @@ FunctionEnd
!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
Page custom InstallOptionsPage
!insertmacro MUI_PAGE_DIRECTORY
-
+
;Start Menu Folder Page Configuration
- !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
- !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
@@ -637,11 +640,12 @@ Section "-Core installation"
;Use the entire tree produced by the INSTALL target. Keep the
;list of directories here in sync with the RMDir commands below.
SetOutPath "$INSTDIR"
+ @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
@CPACK_NSIS_FULL_INSTALL@
-
+
;Store installation folder
WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
-
+
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
Push "DisplayName"
@@ -659,7 +663,7 @@ Section "-Core installation"
Push "NoRepair"
Push "1"
Call ConditionalAddToRegisty
-
+
!ifdef CPACK_NSIS_ADD_REMOVE
;Create add/remove functionality
Push "ModifyPath"
@@ -670,7 +674,7 @@ Section "-Core installation"
Push "1"
Call ConditionalAddToRegisty
!endif
-
+
; Optional registration
Push "DisplayIcon"
Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
@@ -686,7 +690,7 @@ Section "-Core installation"
Call ConditionalAddToRegisty
!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
-
+
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
@CPACK_NSIS_CREATE_ICONS@
@@ -724,7 +728,7 @@ SectionEnd
Section "-Add to path"
Push $INSTDIR\bin
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
- StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
+ StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
Call AddToPath
doNotAddToPath:
SectionEnd
@@ -755,12 +759,12 @@ Function un.onInit
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Power Users group'
Goto done
-
+
noLM:
;Get installation folder from registry if available
done:
-
+
FunctionEnd
;--- Add/Remove callback functions: ---
@@ -769,25 +773,25 @@ FunctionEnd
;List all of your components in following manner here.
@CPACK_NSIS_COMPONENT_SECTION_LIST@
!macroend
-
+
Section -FinishComponents
;Removes unselected components and writes component status to registry
!insertmacro SectionList "FinishSection"
-
-!ifdef CPACK_NSIS_ADD_REMOVE
+
+!ifdef CPACK_NSIS_ADD_REMOVE
; Get the name of the installer executable
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
StrCpy $R3 $R0
-
+
; Strip off the last 13 characters, to see if we have AddRemove.exe
StrLen $R1 $R0
IntOp $R1 $R0 - 13
StrCpy $R2 $R0 13 $R1
StrCmp $R2 "AddRemove.exe" addremove_installed
-
+
; We're not running AddRemove.exe, so install it
CopyFiles $R3 $INSTDIR\AddRemove.exe
-
+
addremove_installed:
!endif
SectionEnd
@@ -804,17 +808,17 @@ FunctionEnd
Section "Uninstall"
ReadRegStr $START_MENU SHCTX \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "StartMenu"
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
;MessageBox MB_OK "Start menu is in: $START_MENU"
ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "DoNotAddToPath"
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathAllUsers"
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathCurrentUser"
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
ReadRegStr $INSTALL_DESKTOP SHCTX \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "InstallToDesktop"
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
@@ -824,14 +828,14 @@ Section "Uninstall"
@CPACK_NSIS_DELETE_FILES@
@CPACK_NSIS_DELETE_DIRECTORIES@
-!ifdef CPACK_NSIS_ADD_REMOVE
+!ifdef CPACK_NSIS_ADD_REMOVE
;Remove the add/remove program
Delete "$INSTDIR\AddRemove.exe"
!endif
;Remove the uninstaller itself.
Delete "$INSTDIR\Uninstall.exe"
- DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@"
+ DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
;Remove the installation directory if it is empty.
RMDir "$INSTDIR"
@@ -840,24 +844,24 @@ Section "Uninstall"
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
; Removes all optional components
- !insertmacro SectionList "RemoveSection"
-
+ !insertmacro SectionList "RemoveSection_CPack"
+
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
-
+
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
@CPACK_NSIS_DELETE_ICONS@
@CPACK_NSIS_DELETE_ICONS_EXTRA@
-
+
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
-
+
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
-
+
IfErrors startMenuDeleteLoopDone
-
+
StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
@@ -866,17 +870,17 @@ Section "Uninstall"
StrCpy $MUI_TEMP "$START_MENU"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
@CPACK_NSIS_DELETE_ICONS_EXTRA@
-
+
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
-
+
secondStartMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
-
+
IfErrors secondStartMenuDeleteLoopDone
-
+
StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
secondStartMenuDeleteLoopDone:
@@ -899,22 +903,44 @@ SectionEnd
; "Program Files" for AllUsers, "My Documents" for JustMe...
Function .onInit
+ StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst
+
+ ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString"
+ StrCmp $0 "" inst
+
+ MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
+ "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \
+ IDYES uninst IDNO inst
+ Abort
+
+;Run the uninstaller
+uninst:
+ ClearErrors
+ ExecWait '$0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
+
+ IfErrors uninst_failed inst
+uninst_failed:
+ MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
+ Abort
+
+
+inst:
; Reads components status for registry
!insertmacro SectionList "InitSection"
- ; check to see if /D has been used to change
- ; the install directory by comparing it to the
+ ; check to see if /D has been used to change
+ ; the install directory by comparing it to the
; install directory that is expected to be the
; default
StrCpy $IS_DEFAULT_INSTALLDIR 0
- StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@" 0 +2
+ StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
StrCpy $IS_DEFAULT_INSTALLDIR 1
-
+
StrCpy $SV_ALLUSERS "JustMe"
; if default install dir then change the default
; if it is installed for JustMe
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
- StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
ClearErrors
UserInfo::GetName
@@ -922,17 +948,17 @@ Function .onInit
Pop $0
UserInfo::GetAccountType
Pop $1
- StrCmp $1 "Admin" 0 +3
+ StrCmp $1 "Admin" 0 +4
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Admin group'
StrCpy $SV_ALLUSERS "AllUsers"
Goto done
- StrCmp $1 "Power" 0 +3
+ StrCmp $1 "Power" 0 +4
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Power Users group'
StrCpy $SV_ALLUSERS "AllUsers"
Goto done
-
+
noLM:
StrCpy $SV_ALLUSERS "AllUsers"
;Get installation folder from registry if available
@@ -940,7 +966,7 @@ Function .onInit
done:
StrCmp $SV_ALLUSERS "AllUsers" 0 +3
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
- StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+ StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"