mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Sync NSIS template with the one from CPack.
This commit is contained in:
parent
b36bfce84f
commit
e985f7ecc3
@ -37,7 +37,12 @@
|
||||
;Set compression
|
||||
SetCompressor @CPACK_NSIS_COMPRESSOR@
|
||||
|
||||
@CPACK_NSIS_DEFINES@
|
||||
;Require administrator access
|
||||
RequestExecutionLevel admin
|
||||
|
||||
@CPACK_NSIS_DEFINES@
|
||||
@CPACK_NSIS_MANIFEST_DPI_AWARE_CODE@
|
||||
@CPACK_NSIS_BRANDING_TEXT_CODE@
|
||||
|
||||
!include Sections.nsh
|
||||
|
||||
@ -71,7 +76,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 +91,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 +115,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_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 +137,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,13 +158,6 @@ Var AR_RegFlags
|
||||
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;--------------------------------
|
||||
; path functions
|
||||
|
||||
!verbose 3
|
||||
!include "WinMessages.NSH"
|
||||
!verbose 4
|
||||
|
||||
;----------------------------------------
|
||||
; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
|
||||
@ -168,7 +166,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 +196,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 +241,7 @@ Function AddToPath
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
|
||||
|
||||
Call IsNT
|
||||
Pop $1
|
||||
StrCmp $1 1 AddToPath_NT
|
||||
@ -258,7 +256,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 +277,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 +285,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 +297,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 +311,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 +326,7 @@ Function un.RemoveFromPath
|
||||
unRemoveFromPath_dosLoopRemoveLine:
|
||||
SetRebootFlag true
|
||||
Goto unRemoveFromPath_dosLoop
|
||||
|
||||
|
||||
unRemoveFromPath_dosLoopEnd:
|
||||
FileClose $2
|
||||
FileClose $1
|
||||
@ -337,7 +335,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 +359,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 +371,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 +381,7 @@ Function un.RemoveFromPath
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Uninstall stuff
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -391,7 +389,7 @@ FunctionEnd
|
||||
###########################################
|
||||
# Utility Functions #
|
||||
###########################################
|
||||
|
||||
|
||||
;====================================================
|
||||
; IsNT - Returns 1 if the current system is NT, 0
|
||||
; otherwise.
|
||||
@ -405,7 +403,7 @@ FunctionEnd
|
||||
; Call IsNT
|
||||
; Pop $R0
|
||||
; ($R0 at this point is 1 or 0)
|
||||
|
||||
|
||||
!macro IsNT un
|
||||
Function ${un}IsNT
|
||||
Push $0
|
||||
@ -415,7 +413,7 @@ Function ${un}IsNT
|
||||
Pop $0
|
||||
Push 0
|
||||
Return
|
||||
|
||||
|
||||
IsNT_yes:
|
||||
; NT!!!
|
||||
Pop $0
|
||||
@ -424,7 +422,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 +435,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,21 +470,21 @@ 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 ConditionalAddToRegistry
|
||||
@ -516,7 +514,7 @@ Function DownloadFile
|
||||
|
||||
try_again:
|
||||
NSISdl::download "$1/$0" "$INSTDIR\$0"
|
||||
|
||||
|
||||
Pop $1
|
||||
StrCmp $1 "success" success
|
||||
StrCmp $1 "Cancelled" cancel
|
||||
@ -527,38 +525,35 @@ Function DownloadFile
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
;--------------------------------
|
||||
; Installation types
|
||||
@CPACK_NSIS_INSTALLATION_TYPES@
|
||||
|
||||
;--------------------------------
|
||||
; Component sections
|
||||
@CPACK_NSIS_COMPONENT_SECTIONS@
|
||||
|
||||
;--------------------------------
|
||||
; Define some macro setting for the gui
|
||||
@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
|
||||
@CPACK_NSIS_INSTALLER_ICON_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
|
||||
@CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
@CPACK_NSIS_INSTALLER_WELCOME_TITLE_CODE@
|
||||
@CPACK_NSIS_INSTALLER_WELCOME_TITLE_3LINES_CODE@
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
|
||||
@CPACK_NSIS_LICENSE_PAGE@
|
||||
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
|
||||
|
||||
@CPACK_NSIS_PAGE_COMPONENTS@
|
||||
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
@CPACK_NSIS_INSTALLER_FINISH_TITLE_CODE@
|
||||
@CPACK_NSIS_INSTALLER_FINISH_TITLE_3LINES_CODE@
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
@ -568,21 +563,27 @@ FunctionEnd
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
||||
!insertmacro MUI_LANGUAGE "Afrikaans"
|
||||
!insertmacro MUI_LANGUAGE "Albanian"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Asturian"
|
||||
!insertmacro MUI_LANGUAGE "Basque"
|
||||
!insertmacro MUI_LANGUAGE "Belarusian"
|
||||
!insertmacro MUI_LANGUAGE "Bosnian"
|
||||
!insertmacro MUI_LANGUAGE "Breton"
|
||||
!insertmacro MUI_LANGUAGE "Bulgarian"
|
||||
!insertmacro MUI_LANGUAGE "Catalan"
|
||||
!insertmacro MUI_LANGUAGE "Corsican"
|
||||
!insertmacro MUI_LANGUAGE "Croatian"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "Danish"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "Esperanto"
|
||||
!insertmacro MUI_LANGUAGE "Estonian"
|
||||
!insertmacro MUI_LANGUAGE "Farsi"
|
||||
!insertmacro MUI_LANGUAGE "Finnish"
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "Galician"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Greek"
|
||||
!insertmacro MUI_LANGUAGE "Hebrew"
|
||||
@ -601,25 +602,31 @@ FunctionEnd
|
||||
!insertmacro MUI_LANGUAGE "Malay"
|
||||
!insertmacro MUI_LANGUAGE "Mongolian"
|
||||
!insertmacro MUI_LANGUAGE "Norwegian"
|
||||
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
|
||||
!insertmacro MUI_LANGUAGE "Pashto"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_LANGUAGE "Russian"
|
||||
!insertmacro MUI_LANGUAGE "ScotsGaelic"
|
||||
!insertmacro MUI_LANGUAGE "Serbian"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "Slovak"
|
||||
!insertmacro MUI_LANGUAGE "Slovenian"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "SpanishInternational"
|
||||
!insertmacro MUI_LANGUAGE "Swedish"
|
||||
!insertmacro MUI_LANGUAGE "Tatar"
|
||||
!insertmacro MUI_LANGUAGE "Thai"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
!insertmacro MUI_LANGUAGE "Turkish"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Uzbek"
|
||||
!insertmacro MUI_LANGUAGE "Vietnamese"
|
||||
!insertmacro MUI_LANGUAGE "Welsh"
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Reserve Files
|
||||
|
||||
@ -630,6 +637,17 @@ FunctionEnd
|
||||
ReserveFile "NSIS.InstallOptions.ini"
|
||||
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
||||
|
||||
; for UserInfo::GetName and UserInfo::GetAccountType
|
||||
ReserveFile /plugin 'UserInfo.dll'
|
||||
|
||||
;--------------------------------
|
||||
; Installation types
|
||||
@CPACK_NSIS_INSTALLATION_TYPES@
|
||||
|
||||
;--------------------------------
|
||||
; Component sections
|
||||
@CPACK_NSIS_COMPONENT_SECTIONS@
|
||||
@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
@ -639,12 +657,12 @@ 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"
|
||||
WriteUninstaller "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
|
||||
Push "DisplayName"
|
||||
Push "@CPACK_NSIS_DISPLAY_NAME@"
|
||||
Call ConditionalAddToRegistry
|
||||
@ -655,12 +673,12 @@ Section "-Core installation"
|
||||
Push "@CPACK_PACKAGE_VENDOR@"
|
||||
Call ConditionalAddToRegistry
|
||||
Push "UninstallString"
|
||||
Push "$INSTDIR\Uninstall.exe"
|
||||
Push "$\"$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe$\""
|
||||
Call ConditionalAddToRegistry
|
||||
Push "NoRepair"
|
||||
Push "1"
|
||||
Call ConditionalAddToRegistry
|
||||
|
||||
|
||||
!ifdef CPACK_NSIS_ADD_REMOVE
|
||||
;Create add/remove functionality
|
||||
Push "ModifyPath"
|
||||
@ -671,7 +689,7 @@ Section "-Core installation"
|
||||
Push "1"
|
||||
Call ConditionalAddToRegistry
|
||||
!endif
|
||||
|
||||
|
||||
; Optional registration
|
||||
Push "DisplayIcon"
|
||||
Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
|
||||
@ -687,12 +705,12 @@ Section "-Core installation"
|
||||
Call ConditionalAddToRegistry
|
||||
!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@
|
||||
@CPACK_NSIS_CREATE_ICONS_EXTRA@
|
||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
|
||||
|
||||
;Read a value from an InstallOptions INI file
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
|
||||
@ -717,7 +735,7 @@ Section "-Core installation"
|
||||
Call ConditionalAddToRegistry
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
|
||||
detailPrint "Installing InspIRCd service..."
|
||||
nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\inspircd.exe" --installservice'
|
||||
|
||||
@ -728,7 +746,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
|
||||
@ -759,12 +777,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: ---
|
||||
@ -773,25 +791,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
|
||||
@ -831,13 +849,13 @@ 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"
|
||||
Delete "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
|
||||
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
|
||||
;Remove the installation directory if it is empty.
|
||||
@ -848,23 +866,23 @@ Section "Uninstall"
|
||||
|
||||
; Removes all optional components
|
||||
!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 directories
|
||||
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:
|
||||
|
||||
@ -873,17 +891,17 @@ Section "Uninstall"
|
||||
StrCpy $MUI_TEMP "$START_MENU"
|
||||
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
||||
@CPACK_NSIS_DELETE_ICONS_EXTRA@
|
||||
|
||||
|
||||
;Delete empty start menu parent directories
|
||||
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:
|
||||
|
||||
@ -908,18 +926,22 @@ 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 \
|
||||
"@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
|
||||
/SD IDYES IDYES uninst IDNO inst
|
||||
Abort
|
||||
|
||||
;Run the uninstaller
|
||||
uninst:
|
||||
ClearErrors
|
||||
ExecWait '$0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
|
||||
StrCpy $2 $0 1
|
||||
StrCmp '"' $2 0 +3 ; checks if string is quoted (CPack before v3.20.6 did not quote it)
|
||||
ExecWait '$0 /S'
|
||||
Goto +2
|
||||
ExecWait '"$0" /S'
|
||||
|
||||
IfErrors uninst_failed inst
|
||||
uninst_failed:
|
||||
@ -931,14 +953,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
|
||||
@ -961,7 +983,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user