diff options
author | Anton Fedchin <anightik@gmail.com> | 2017-03-02 17:45:01 +0300 |
---|---|---|
committer | Anton Fedchin <anightik@gmail.com> | 2017-03-03 08:43:04 +0300 |
commit | b22579bcec2e294e89c538538e051118765b7bab (patch) | |
tree | c478a4fdb68dd5f285005cd9002fcfaaded36c40 | |
parent | 96452142426a3ec9fdf543d8f1778171be3cef4b (diff) |
[win32] installer: added checks for required updates and SPs.
-rw-r--r-- | project/Win32BuildSetup/genNsisInstaller.nsi | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/project/Win32BuildSetup/genNsisInstaller.nsi b/project/Win32BuildSetup/genNsisInstaller.nsi index a5741774ea..54419ca7df 100644 --- a/project/Win32BuildSetup/genNsisInstaller.nsi +++ b/project/Win32BuildSetup/genNsisInstaller.nsi @@ -331,9 +331,44 @@ SectionEnd SectionGroupEnd Function .onInit + ; WinVista SP2 is minimum requirement ${IfNot} ${AtLeastWinVista} - MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Windows Vista or above required.$\nThis program can not be run on Windows XP" + ${OrIf} ${IsWinVista} + ${AndIfNot} ${AtLeastServicePack} 2 + MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Windows Vista SP2 or above required.$\nInstall Service Pack 2 for Windows Vista and run setup again." Quit ${EndIf} + ; Win7 SP1 is minimum requirement + ${If} ${IsWin7} + ${AndIfNot} ${AtLeastServicePack} 1 + MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Windows 7 SP1 or above required.$\nInstall Service Pack 1 for Windows 7 and run setup again." + Quit + ${EndIf} + + Var /GLOBAL HotFixID + ${If} ${IsWinVista} + StrCpy $HotFixID "971644" ; Platform Update for Windows Vista SP2 + ${ElseIf} ${IsWin7} + StrCpy $HotFixID "2670838" ; Platform Update for Windows 7 SP1 + ${Else} + StrCpy $HotFixID "" + ${Endif} + ${If} $HotFixID != "" + SetOutPath "$TEMP\PS" + FileOpen $0 ps.ps1 w + FileWrite $0 "Get-HotFix -Id KB$HotFixID -ea SilentlyContinue" + FileClose $0 + nsExec::ExecToStack 'powershell -noprofile -inputformat none -ExecutionPolicy RemoteSigned -File "$TEMP\PS\ps.ps1"' + Pop $0 ; return value (it always 0 even if an error occured) + Pop $1 ; command output + RMDir /r "$TEMP\PS" + ${If} $0 != 0 + ${OrIf} $1 == "" + MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Platform Update for Windows (KB$HotFixID) is required.$\nDownload and install Platform Update for Windows then run setup again." + ExecShell "open" "http://support.microsoft.com/kb/$HotFixID" + Quit + ${EndIf} + SetOutPath "$INSTDIR" + ${EndIf} StrCpy $CleanDestDir "-1" FunctionEnd |