diff options
Diffstat (limited to 'Modules/NSIS.template.in')
-rw-r--r-- | Modules/NSIS.template.in | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 43f72f6aa..ffc425e67 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -37,7 +37,7 @@ ;Set compression SetCompressor @CPACK_NSIS_COMPRESSOR@ -@CPACK_NSIS_DEFINES@ +@CPACK_NSIS_DEFINES@ !include Sections.nsh @@ -71,7 +71,7 @@ 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_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed" @@ -86,20 +86,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} @@ -110,20 +110,20 @@ Var AR_RegFlags 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_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ "Installed" 1 - + "exit_${SecName}:" !macroend - + !macro RemoveSection 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 +132,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 +153,7 @@ Var AR_RegFlags !define MUI_HEADERIMAGE !define MUI_ABORTWARNING - + ;-------------------------------- ; path functions @@ -168,7 +168,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 +198,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 +243,7 @@ Function AddToPath Call StrStr Pop $2 StrCmp $2 "" "" AddToPath_done - + Call IsNT Pop $1 StrCmp $1 1 AddToPath_NT @@ -258,7 +258,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 +279,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 +287,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 +299,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 +313,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 +328,7 @@ Function un.RemoveFromPath unRemoveFromPath_dosLoopRemoveLine: SetRebootFlag true Goto unRemoveFromPath_dosLoop - + unRemoveFromPath_dosLoopEnd: FileClose $2 FileClose $1 @@ -337,7 +337,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 +361,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 +373,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 +383,7 @@ Function un.RemoveFromPath Pop $1 Pop $0 FunctionEnd - + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Uninstall sutff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -391,7 +391,7 @@ FunctionEnd ########################################### # Utility Functions # ########################################### - + ;==================================================== ; IsNT - Returns 1 if the current system is NT, 0 ; otherwise. @@ -405,7 +405,7 @@ FunctionEnd ; Call IsNT ; Pop $R0 ; ($R0 at this point is 1 or 0) - + !macro IsNT un Function ${un}IsNT Push $0 @@ -415,7 +415,7 @@ Function ${un}IsNT Pop $0 Push 0 Return - + IsNT_yes: ; NT!!! Pop $0 @@ -424,7 +424,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 +437,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 @@ -481,7 +481,7 @@ Loop: StrCmp "$R2" "$\r" RTrim StrCmp "$R2" ";" RTrim GoTo Done -RTrim: +RTrim: StrCpy $R1 "$R1" -1 Goto Loop Done: @@ -516,7 +516,7 @@ Function DownloadFile try_again: NSISdl::download "$1/$0" "$INSTDIR\$0" - + Pop $1 StrCmp $1 "success" success StrCmp $1 "Cancelled" cancel @@ -549,10 +549,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 @@ -639,10 +639,10 @@ Section "-Core installation" 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" @@ -660,7 +660,7 @@ Section "-Core installation" Push "NoRepair" Push "1" Call ConditionalAddToRegisty - + !ifdef CPACK_NSIS_ADD_REMOVE ;Create add/remove functionality Push "ModifyPath" @@ -671,7 +671,7 @@ Section "-Core installation" Push "1" Call ConditionalAddToRegisty !endif - + ; Optional registration Push "DisplayIcon" Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" @@ -687,7 +687,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@ @@ -725,7 +725,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 @@ -756,12 +756,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: --- @@ -770,25 +770,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 @@ -825,7 +825,7 @@ 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 @@ -842,23 +842,23 @@ Section "Uninstall" ; Removes all optional components !insertmacro SectionList "RemoveSection" - + !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: @@ -867,17 +867,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: @@ -902,7 +902,7 @@ SectionEnd Function .onInit StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst - ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "UninstallString" + ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString" StrCmp $0 "" inst MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ @@ -925,14 +925,14 @@ 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_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 @@ -955,7 +955,7 @@ inst: ;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 |