Merge pull request #38726 from twangboy/vcredist

Add VC Redist 2008 SP1 MFC to installer
This commit is contained in:
Mike Place 2017-01-19 12:13:41 -07:00 committed by GitHub
commit 10a3d8b8dd
3 changed files with 125 additions and 0 deletions

View File

@ -9,6 +9,7 @@
Set "CurrDir=%cd%"
Set "BinDir=%cd%\buildenv\bin"
Set "InsDir=%cd%\installer"
Set "PreDir=%cd%\prereqs"
Set "PyDir=C:\Python27"
:: Get the version from git if not passed
@ -37,6 +38,21 @@ If Exist "%BinDir%\" rd /S /Q "%BinDir%"
xcopy /E /Q "%PyDir%" "%BinDir%\"
@echo.
@echo Copying VCRedist 2008 MFC to Prerequisites
@echo ----------------------------------------------------------------------
:: Make sure the "prereq" directory exists
If NOT Exist "%PreDir%" mkdir "%PreDir%"
:: Check for 64 bit by finding the Program Files (x86) directory
Set Url64="http://repo.saltstack.com/windows/dependencies/64/vcredist_x64_2008_mfc.exe"
Set Url32="http://repo.saltstack.com/windows/dependencies/32/vcredist_x86_2008_mfc.exe"
If Exist "C:\Program Files (x86)" (
bitsadmin /transfer "VCRedist 2008 MFC AMD64" "%Url64%" "%PreDir%\vcredist.exe"
) Else (
bitsadmin /transfer "VCRedist 2008 MFC x86" "%Url32%" "%PreDir%\vcredist.exe"
)
@echo.
:: Remove the fixed path in .exe files
@echo Removing fixed path from .exe files
@echo ----------------------------------------------------------------------

View File

@ -174,6 +174,44 @@ ShowInstDetails show
ShowUnInstDetails show
; Check and install Visual C++ 2008 SP1 MFC Security Update redist packages
; See http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx for more info
Section -Prerequisites
!define VC_REDIST_X64_GUID "{5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4}"
!define VC_REDIST_X86_GUID "{9BE518E6-ECC6-35A9-88E4-87755C07200F}"
Var /GLOBAL VcRedistGuid
Var /GLOBAL NeedVcRedist
${If} ${CPUARCH} == "AMD64"
StrCpy $VcRedistGuid ${VC_REDIST_X64_GUID}
${Else}
StrCpy $VcRedistGuid ${VC_REDIST_X86_GUID}
${EndIf}
Push $VcRedistGuid
Call MsiQueryProductState
${If} $NeedVcRedist == "True"
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
"VC Redist 2008 SP1 MFC is currently not installed. Would you like to install?" \
/SD IDYES IDNO endVcRedist
ClearErrors
; The Correct version of VCRedist is copied over by "build_pkg.bat"
SetOutPath "$INSTDIR\"
File "..\prereqs\vcredist.exe"
ExecWait "$INSTDIR\vcredist.exe /qb!"
IfErrors 0 endVcRedist
MessageBox MB_OK \
"VC Redist 2008 SP1 MFC failed to install. Try installing the package manually." \
/SD IDOK
endVcRedist:
${EndIf}
SectionEnd
Section "MainSection" SEC01
SetOutPath "$INSTDIR\"
@ -235,6 +273,7 @@ Function .onInit
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\nssm.exe"
Delete "$INSTDIR\salt*"
Delete "$INSTDIR\vcredist.exe"
RMDir /r "$INSTDIR\bin"
; Remove registry entries
@ -300,6 +339,8 @@ Section -Post
Push "C:\salt"
Call AddToPath
Delete "$INSTDIR\vcredist.exe"
SectionEnd
@ -331,6 +372,7 @@ Section Uninstall
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\nssm.exe"
Delete "$INSTDIR\salt*"
Delete "$INSTDIR\vcredist.exe"
; Remove salt directory, you must check to make sure you're not removing
; the Program Files directory
@ -366,6 +408,18 @@ FunctionEnd
###############################################################################
# Helper Functions
###############################################################################
Function MsiQueryProductState
!define INSTALLSTATE_DEFAULT "5"
Pop $R0
StrCpy $NeedVcRedist "False"
System::Call "msi::MsiQueryProductStateA(t '$R0') i.r0"
StrCmp $0 ${INSTALLSTATE_DEFAULT} +2 0
StrCpy $NeedVcRedist "True"
FunctionEnd
Function Trim

View File

@ -306,6 +306,45 @@ ShowInstDetails show
ShowUnInstDetails show
; Check and install Visual C++ 2008 SP1 MFC Security Update redist packages
; See http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx for more info
Section -Prerequisites
!define VC_REDIST_X64_GUID "{5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4}"
!define VC_REDIST_X86_GUID "{9BE518E6-ECC6-35A9-88E4-87755C07200F}"
Var /GLOBAL VcRedistGuid
Var /GLOBAL NeedVcRedist
${If} ${CPUARCH} == "AMD64"
StrCpy $VcRedistGuid ${VC_REDIST_X64_GUID}
${Else}
StrCpy $VcRedistGuid ${VC_REDIST_X86_GUID}
${EndIf}
Push $VcRedistGuid
Call MsiQueryProductState
${If} $NeedVcRedist == "True"
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
"VC Redist 2008 SP1 MFC is currently not installed. Would you like to install?" \
/SD IDYES IDNO endVcRedist
ClearErrors
; The Correct version of VCRedist is copied over by "build_pkg.bat"
SetOutPath "$INSTDIR\"
File "..\prereqs\vcredist.exe"
ExecWait "$INSTDIR\vcredist.exe /qb!"
IfErrors 0 endVcRedist
MessageBox MB_OK \
"VC Redist 2008 SP1 MFC failed to install. Try installing the package manually." \
/SD IDOK
endVcRedist:
${EndIf}
SectionEnd
Section "MainSection" SEC01
SetOutPath "$INSTDIR\"
@ -367,6 +406,7 @@ Function .onInit
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\nssm.exe"
Delete "$INSTDIR\salt*"
Delete "$INSTDIR\vcredist.exe"
RMDir /r "$INSTDIR\bin"
; Remove registry entries
@ -477,6 +517,8 @@ Section -Post
Push "C:\salt"
Call AddToPath
Delete "$INSTDIR\vcredist.exe"
SectionEnd
@ -516,6 +558,7 @@ Section Uninstall
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\nssm.exe"
Delete "$INSTDIR\salt*"
Delete "$INSTDIR\vcredist.exe"
; Remove salt directory, you must check to make sure you're not removing
; the Program Files directory
@ -556,6 +599,18 @@ FunctionEnd
###############################################################################
# Helper Functions
###############################################################################
Function MsiQueryProductState
!define INSTALLSTATE_DEFAULT "5"
Pop $R0
StrCpy $NeedVcRedist "False"
System::Call "msi::MsiQueryProductStateA(t '$R0') i.r0"
StrCmp $0 ${INSTALLSTATE_DEFAULT} +2 0
StrCpy $NeedVcRedist "True"
FunctionEnd
Function Trim