mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 01:30:20 +00:00
Remove vcredist and ucrt from Windows install
This commit is contained in:
parent
ebb02d6c3a
commit
e525bbada3
7 changed files with 1 additions and 270 deletions
|
@ -103,7 +103,6 @@ if ( $install_build_tools ) {
|
|||
"--add Microsoft.VisualStudio.Component.Windows81SDK", `
|
||||
"--add Microsoft.VisualStudio.Component.Windows10SDK.17763", `
|
||||
"--add Microsoft.VisualStudio.Component.VC.140", `
|
||||
"--add Microsoft.Component.VC.Runtime.UCRTSDK", `
|
||||
"--lang en-US", `
|
||||
"--includeRecommended", `
|
||||
"--quiet", `
|
||||
|
|
|
@ -246,17 +246,6 @@ IMCAC - Immediate Custom Action - It's immediate
|
|||
<CustomAction Id="DeleteConfig2_CADH" Property="DeleteConfig2_DECAC" Value="CLEAN_INSTALL=[CLEAN_INSTALL];REMOVE_CONFIG=[REMOVE_CONFIG];INSTALLDIR=[INSTALLDIR];ROOTDIR=[ROOTDIR];" />
|
||||
<CustomAction Id="MoveInsecureConfig_CADH" Property="MoveInsecureConfig_DECAC" Value="INSECURE_CONFIG_FOUND=[INSECURE_CONFIG_FOUND];" />
|
||||
|
||||
<!-- Install VC++ runtime -->
|
||||
<DirectoryRef Id="TARGETDIR">
|
||||
<!-- Visual C++ runtimes depend on the target platform -->
|
||||
<?if $(var.WIN64)=yes ?>
|
||||
<Merge Id="MSM_VC120_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC120_CRT_x64.msm" DiskId="1" Language="0" />
|
||||
<Merge Id="MSM_VC140_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC140_CRT_x64.msm" DiskId="1" Language="0" />
|
||||
<?else ?>
|
||||
<Merge Id="MSM_VC120_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC120_CRT_x86.msm" DiskId="1" Language="0" />
|
||||
<Merge Id="MSM_VC140_CRT" SourceFile="$(var.WEBCACHE_DIR)\Microsoft_VC140_CRT_x86.msm" DiskId="1" Language="0" />
|
||||
<?endif ?>
|
||||
</DirectoryRef>
|
||||
<!-- Add INSTALLDIR to the system Path -->
|
||||
<DirectoryRef Id="TARGETDIR">
|
||||
<Component Id="INSTALLDIR_System_Path" Guid="A9F54641-91F8-4AFB-B812-9409E6EA0192">
|
||||
|
@ -269,8 +258,6 @@ IMCAC - Immediate Custom Action - It's immediate
|
|||
<!-- Leaving registry keys would mean the product is still installed -->
|
||||
<Feature Id="ProductFeature" Title="Minion" Level="1">
|
||||
<ComponentGroupRef Id="ProductComponents" />
|
||||
<Feature Id="VC120" Title="VC++ 2013" AllowAdvertise="no" Display="hidden"><MergeRef Id="MSM_VC120_CRT" /></Feature>
|
||||
<Feature Id="VC140" Title="VC++ 2015" AllowAdvertise="no" Display="hidden"><MergeRef Id="MSM_VC140_CRT" /></Feature>
|
||||
</Feature>
|
||||
|
||||
<!-- Get the config file template from the msi store only if no config is present -->
|
||||
|
|
|
@ -10,10 +10,6 @@ You need
|
|||
- .Net 3.5 SDK (for WiX)<sup>*</sup>
|
||||
- [Wix 3](http://wixtoolset.org/releases/)<sup>**</sup>
|
||||
- [Build tools 2015](https://www.microsoft.com/en-US/download/confirmation.aspx?id=48159)<sup>**</sup>
|
||||
- Microsoft_VC140_CRT_x64.msm from Visual Studio 2015<sup>**</sup>
|
||||
- Microsoft_VC140_CRT_x86.msm from Visual Studio 2015<sup>**</sup>
|
||||
- Microsoft_VC120_CRT_x64.msm from Visual Studio 2013<sup>**</sup>
|
||||
- Microsoft_VC120_CRT_x86.msm from Visual Studio 2013<sup>**</sup>
|
||||
|
||||
Notes:
|
||||
- <sup>*</sup> `build.cmd` will open `optionalfeatures` if necessary.
|
||||
|
|
|
@ -73,8 +73,6 @@ function VerifyOrDownload ($local_file, $URL, $SHA256) {
|
|||
# Script Variables
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
$WEBCACHE_DIR = "$env:TEMP\msi_build_cache_dir"
|
||||
$DEPS_URL = "https://repo.saltproject.io/windows/dependencies"
|
||||
$PROJECT_DIR = $(git rev-parse --show-toplevel)
|
||||
$BUILD_DIR = "$PROJECT_DIR\pkg\windows\build"
|
||||
$BUILDENV_DIR = "$PROJECT_DIR\pkg\windows\buildenv"
|
||||
|
@ -121,21 +119,6 @@ Write-Host "- Architecture: $BUILD_ARCH"
|
|||
Write-Host "- Salt Version: $Version"
|
||||
Write-Host $("-" * 80)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Ensure cache dir exists
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
if ( ! (Test-Path -Path $WEBCACHE_DIR) ) {
|
||||
Write-Host "Creating cache directory: " -NoNewline
|
||||
New-Item -ItemType directory -Path $WEBCACHE_DIR | Out-Null
|
||||
if ( Test-Path -Path $WEBCACHE_DIR ) {
|
||||
Write-Result "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Result "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Ensure WIX environment variable is set, if not refresh and check again
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -156,21 +139,6 @@ if ( ! "$env:WIX" ) {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Caching VC++ Runtimes
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
$RUNTIMES = @(
|
||||
("Microsoft_VC120_CRT_x64.msm", "64", "15FD10A495287505184B8913DF8D6A9CA461F44F78BC74115A0C14A5EDD1C9A7"),
|
||||
("Microsoft_VC120_CRT_x86.msm", "32", "26340B393F52888B908AC3E67B935A80D390E1728A31FF38EBCEC01117EB2579"),
|
||||
("Microsoft_VC140_CRT_x64.msm", "64", "E1344D5943FB2BBB7A56470ED0B7E2B9B212CD9210D3CC6FA82BC3DA8F11EDA8"),
|
||||
("Microsoft_VC140_CRT_x86.msm", "32", "0D36CFE6E9ABD7F530DBAA4A83841CDBEF9B2ADCB625614AF18208FDCD6B92A4")
|
||||
)
|
||||
$RUNTIMES | ForEach-Object {
|
||||
$name, $arch, $hash = $_
|
||||
VerifyOrDownload "$WEBCACHE_DIR\$name" "$DEPS_URL/$arch/$name" "$hash"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Converting to MSI Version
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -531,7 +499,6 @@ Push-Location $SCRIPT_DIR
|
|||
-dDisplayVersion="$Version" `
|
||||
-dInternalVersion="$INTERNAL_VERSION" `
|
||||
-dDISCOVER_INSTALLDIR="$($DISCOVER_INSTALLDIR[$i])" `
|
||||
-dWEBCACHE_DIR="$WEBCACHE_DIR" `
|
||||
-dDISCOVER_CONFDIR="$DISCOVER_CONFDIR" `
|
||||
-ext "$($ENV:WIX)bin\WixUtilExtension.dll" `
|
||||
-ext "$($ENV:WIX)bin\WixUIExtension.dll" `
|
||||
|
|
|
@ -524,171 +524,6 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
|||
ShowInstDetails show
|
||||
ShowUnInstDetails show
|
||||
|
||||
|
||||
Section -copy_prereqs
|
||||
# Copy prereqs to the Plugins Directory
|
||||
# These files are downloaded by build_pkg.bat
|
||||
# This directory gets removed upon completion
|
||||
SetOutPath "$PLUGINSDIR\"
|
||||
File /r "..\..\prereqs\"
|
||||
SectionEnd
|
||||
|
||||
# Check if the Windows 10 Universal C Runtime (KB2999226) is installed. Python
|
||||
# 3 needs the updated ucrt on Windows 8.1/2012R2 and lower. They are installed
|
||||
# via KB2999226, but we're not going to patch the system here. Instead, we're
|
||||
# going to copy the .dll files to the \salt\bin directory
|
||||
Section -install_ucrt
|
||||
|
||||
Var /GLOBAL UcrtFileName
|
||||
|
||||
# Get the Major.Minor version Number
|
||||
# Windows 10 introduced CurrentMajorVersionNumber
|
||||
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" \
|
||||
CurrentMajorVersionNumber
|
||||
|
||||
# Windows 10/2016 will return a value here, skip to the end if returned
|
||||
StrCmp $R0 '' lbl_needs_ucrt 0
|
||||
|
||||
# Found Windows 10
|
||||
detailPrint "KB2999226 does not apply to this machine"
|
||||
goto lbl_done
|
||||
|
||||
lbl_needs_ucrt:
|
||||
# UCRT only needed on Windows Server 2012R2/Windows 8.1 and below. The
|
||||
# first ReadRegStr command above should have skipped to lbl_done if on
|
||||
# Windows 10 box
|
||||
|
||||
# Is the update already installed
|
||||
ClearErrors
|
||||
|
||||
# Use WMI to check if it's installed
|
||||
detailPrint "Checking for existing UCRT (KB2999226) installation"
|
||||
nsExec::ExecToStack 'cmd /q /c wmic qfe get hotfixid | findstr "^KB2999226"'
|
||||
# Clean up the stack
|
||||
Pop $R0 # Gets the ErrorCode
|
||||
Pop $R1 # Gets the stdout, which should be KB2999226 if it's installed
|
||||
|
||||
# If it returned KB2999226 it's already installed
|
||||
StrCmp $R1 'KB2999226' lbl_done
|
||||
|
||||
detailPrint "UCRT (KB2999226) not found"
|
||||
|
||||
# Use RunningX64 here to get the Architecture for the system running the
|
||||
# installer.
|
||||
${If} ${RunningX64}
|
||||
StrCpy $UcrtFileName "ucrt_x64.zip"
|
||||
${Else}
|
||||
StrCpy $UcrtFileName "ucrt_x86.zip"
|
||||
${EndIf}
|
||||
|
||||
ClearErrors
|
||||
|
||||
detailPrint "Unzipping UCRT dll files to $INSTDIR\Scripts"
|
||||
CreateDirectory $INSTDIR\Scripts
|
||||
nsisunz::UnzipToLog "$PLUGINSDIR\$UcrtFileName" "$INSTDIR\Scripts"
|
||||
|
||||
# Clean up the stack
|
||||
Pop $R0 # Get Error
|
||||
|
||||
${IfNot} $R0 == "success"
|
||||
detailPrint "error: $R0"
|
||||
Sleep 3000
|
||||
${Else}
|
||||
detailPrint "UCRT dll files copied successfully"
|
||||
${EndIf}
|
||||
|
||||
lbl_done:
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
# Check and install Visual C++ redist 2013 packages
|
||||
# Hidden section (-) to install VCRedist
|
||||
Section -install_vcredist_2013
|
||||
|
||||
Var /GLOBAL VcRedistName
|
||||
Var /GLOBAL VcRedistReg
|
||||
|
||||
# Only install 64bit VCRedist on 64bit machines
|
||||
# Use RunningX64 here to get the Architecture for the system running the
|
||||
# installer.
|
||||
${If} ${RunningX64}
|
||||
StrCpy $VcRedistName "vcredist_x64_2013"
|
||||
StrCpy $VcRedistReg "SOFTWARE\WOW6432Node\Microsoft\VisualStudio\12.0\VC\Runtimes\x64"
|
||||
${Else}
|
||||
StrCpy $VcRedistName "vcredist_x86_2013"
|
||||
StrCpy $VcRedistReg "SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86"
|
||||
${EndIf}
|
||||
|
||||
# Detecting VCRedist Installation
|
||||
detailPrint "Checking for $VcRedistName..."
|
||||
ReadRegDword $0 HKLM $VcRedistReg "Installed"
|
||||
StrCmp $0 "1" +2 0
|
||||
Call InstallVCRedist
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
Function InstallVCRedist
|
||||
detailPrint "System requires $VcRedistName"
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
|
||||
"$VcRedistName is currently not installed. Would you like to \
|
||||
install?" \
|
||||
/SD IDYES IDYES InstallVcRedist
|
||||
|
||||
detailPrint "$VcRedistName not installed"
|
||||
detailPrint ">>>Installation aborted by user<<<"
|
||||
MessageBox MB_ICONEXCLAMATION \
|
||||
"$VcRedistName not installed. Aborted by user.$\n$\n\
|
||||
Installer will now close." \
|
||||
/SD IDOK
|
||||
Quit
|
||||
|
||||
InstallVcRedist:
|
||||
|
||||
# If an output variable is specified ($0 in the case below), ExecWait
|
||||
# sets the variable with the exit code (and only sets the error flag if
|
||||
# an error occurs; if an error occurs, the contents of the user
|
||||
# variable are undefined).
|
||||
# http://nsis.sourceforge.net/Reference/ExecWait
|
||||
ClearErrors
|
||||
detailPrint "Installing $VcRedistName..."
|
||||
ExecWait '"$PLUGINSDIR\$VcRedistName.exe" /install /quiet /norestart' $0
|
||||
|
||||
IfErrors 0 CheckVcRedistErrorCode
|
||||
|
||||
detailPrint "An error occurred during installation of $VcRedistName"
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION \
|
||||
"$VcRedistName failed to install. Try installing the package \
|
||||
manually.$\n$\n\
|
||||
The installer will now close." \
|
||||
/SD IDOK
|
||||
Quit
|
||||
|
||||
CheckVcRedistErrorCode:
|
||||
# Check for Reboot Error Code (3010)
|
||||
${If} $0 == 3010
|
||||
detailPrint "$VcRedistName installed but requires a restart to complete."
|
||||
detailPrint "Reboot and run Salt install again"
|
||||
MessageBox MB_OK|MB_ICONINFORMATION \
|
||||
"$VcRedistName installed but requires a restart to complete." \
|
||||
/SD IDOK
|
||||
|
||||
# Check for any other errors
|
||||
${ElseIfNot} $0 == 0
|
||||
detailPrint "An error occurred during installation of $VcRedistName"
|
||||
detailPrint "Error: $0"
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION \
|
||||
"$VcRedistName failed to install. Try installing the package \
|
||||
mnually.$\n\
|
||||
ErrorCode: $0$\n\
|
||||
The installer will now close." \
|
||||
/SD IDOK
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section "MainSection" SEC01
|
||||
|
||||
${If} $MoveExistingConfig == 1
|
||||
|
@ -763,7 +598,6 @@ Function .onInit
|
|||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
InitPluginsDir
|
||||
Call parseInstallerCommandLineSwitches
|
||||
|
||||
# Uninstall msi-installed salt
|
||||
|
|
|
@ -35,7 +35,6 @@ $SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").Directo
|
|||
$WINDOWS_DIR = "$PROJECT_DIR\pkg\windows"
|
||||
$NSIS_DIR = "$WINDOWS_DIR\nsis"
|
||||
$BUILDENV_DIR = "$WINDOWS_DIR\buildenv"
|
||||
$PREREQS_DIR = "$WINDOWS_DIR\prereqs"
|
||||
$NSIS_BIN = "$( ${env:ProgramFiles(x86)} )\NSIS\makensis.exe"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -50,8 +49,7 @@ Write-Host $("-" * 80)
|
|||
# Setup Directories
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
$directories = "$PREREQS_DIR",
|
||||
"$BUILDENV_DIR",
|
||||
$directories = "$BUILDENV_DIR",
|
||||
"$BUILDENV_DIR\configs"
|
||||
$directories | ForEach-Object {
|
||||
if ( ! (Test-Path -Path "$_") ) {
|
||||
|
@ -70,21 +68,6 @@ $directories | ForEach-Object {
|
|||
# Create binaries
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
$prereq_files = "vcredist_x86_2013.exe",
|
||||
"vcredist_x64_2013.exe",
|
||||
"ucrt_x86.zip",
|
||||
"ucrt_x64.zip"
|
||||
$prereq_files | ForEach-Object {
|
||||
Write-Host "Creating $_`: " -NoNewline
|
||||
Set-Content -Path "$PREREQS_DIR\$_" -Value "binary"
|
||||
if ( Test-Path -Path "$PREREQS_DIR\$_" ) {
|
||||
Write-Result "Success"
|
||||
} else {
|
||||
Write-Result "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
$binary_files = "ssm.exe",
|
||||
"python.exe"
|
||||
$binary_files | ForEach-Object {
|
||||
|
|
|
@ -62,7 +62,6 @@ if ( $BuildDir ) {
|
|||
} else {
|
||||
$BUILD_DIR = "$SCRIPT_DIR\buildenv"
|
||||
}
|
||||
$PREREQ_DIR = "$SCRIPT_DIR\prereqs"
|
||||
$SCRIPTS_DIR = "$BUILD_DIR\Scripts"
|
||||
$BUILD_CONF_DIR = "$BUILD_DIR\configs"
|
||||
$SITE_PKGS_DIR = "$BUILD_DIR\Lib\site-packages"
|
||||
|
@ -126,17 +125,6 @@ if ( Test-Path -Path $BUILD_CONF_DIR) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( Test-Path -Path $PREREQ_DIR ) {
|
||||
Write-Host "Removing PreReq Directory: " -NoNewline
|
||||
Remove-Item -Path $PREREQ_DIR -Recurse -Force
|
||||
if ( ! (Test-Path -Path $PREREQ_DIR) ) {
|
||||
Write-Result "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Result "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Staging the Build Environment
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -183,29 +171,6 @@ $scripts | ForEach-Object {
|
|||
}
|
||||
}
|
||||
|
||||
# Copy VCRedist 2013 to the prereqs directory
|
||||
New-Item -Path $PREREQ_DIR -ItemType Directory | Out-Null
|
||||
Write-Host "Copying VCRedist 2013 $ARCH_X to prereqs: " -NoNewline
|
||||
$file = "vcredist_$ARCH_X`_2013.exe"
|
||||
Invoke-WebRequest -Uri "$SALT_DEP_URL/$file" -OutFile "$PREREQ_DIR\$file"
|
||||
if ( Test-Path -Path "$PREREQ_DIR\$file" ) {
|
||||
Write-Result "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Result "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Copy Universal C Runtimes to the prereqs directory
|
||||
Write-Host "Copying Universal C Runtimes $ARCH_X to prereqs: " -NoNewline
|
||||
$file = "ucrt_$ARCH_X.zip"
|
||||
Invoke-WebRequest -Uri "$SALT_DEP_URL/$file" -OutFile "$PREREQ_DIR\$file"
|
||||
if ( Test-Path -Path "$PREREQ_DIR\$file" ) {
|
||||
Write-Result "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Result "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Remove binaries not needed by Salt
|
||||
#-------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue