Updated NSIS installer scripts (with .NET 4.0 detection).

This commit is contained in:
Lorenz Cuno Klopfenstein 2012-11-06 20:28:38 +01:00
parent e5ba5c32e9
commit 726879dfdf
2 changed files with 47 additions and 2 deletions

32
Installer/DotNet.nsh Normal file
View file

@ -0,0 +1,32 @@
# .NET Installation checker
!macro HasDotNet4 OutVar
Push "Install" ;reg key
Push "Software\Microsoft\NET Framework Setup\NDP\v4\Client" ;v4.0 client reg node
Call HasDotNet4Core
Pop ${OutVar}
!macroend
!define HasDotNet4 "!insertmacro HasDotNet4"
Function HasDotNet4Core
Pop $R0 ;reg node to check
Pop $R1 ;reg key
ReadRegDWORD $R3 HKLM $R0 $R1
;MessageBox MB_OK "$R0 \ $R1 value is $R3"
;IntOp $R8 $R3 % 1 ;logical AND with 1 (should evaluate to 1 in $R8)
IntCmp $R3 1 has hasNot has ;jump if >= 1
has:
Push 1
Goto exit
hasNot:
Push 0
Goto exit
exit:
FunctionEnd

View file

@ -1,6 +1,7 @@
# INCLUDES
!include MUI2.nsh ;Modern interface
!include LogicLib.nsh ;nsDialogs
!include "DotNet.nsh"
# INIT
Name "OnTopReplica"
@ -47,14 +48,26 @@ RequestExecutionLevel user
# LANGUAGES
!insertmacro MUI_LANGUAGE "English"
# INITIALIZATION AND ERROR CHECKING
Function .onInit
${HasDotNet4} $R0
${If} $R0 == 2
;noop
${Else}
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "Microsoft .NET Framework 4.0 appears not to be installed.$\n$\nOnTopReplica requires .NET 4.0 to run: please install it before running the installer.$\n$\nDo you wish to proceed anyway?" IDOK proceedAnyway
Abort ".NET 4.0 required to install"
proceedAnyway:
${EndIf}
FunctionEnd
# CALLBACKS
Function RegisterApplication
;Register uninstaller into Add/Remove panel (for local user only)
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayName" "OnTopReplica"
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayIcon" "$\"$INSTDIR\OnTopReplica.exe$\""
WriteRegStr HKCU "${REG_UNINSTALL}" "Publisher" "Lorenz Cuno Klopfenstein"
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayVersion" "3.3.1.0"
WriteRegDWord HKCU "${REG_UNINSTALL}" "EstimatedSize" 960 ;KB
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayVersion" "3.4"
WriteRegDWord HKCU "${REG_UNINSTALL}" "EstimatedSize" 922 ;KB
WriteRegStr HKCU "${REG_UNINSTALL}" "HelpLink" "${WEBSITE_LINK}"
WriteRegStr HKCU "${REG_UNINSTALL}" "URLInfoAbout" "${WEBSITE_LINK}"
WriteRegStr HKCU "${REG_UNINSTALL}" "InstallLocation" "$\"$INSTDIR$\""