mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 01:55:20 +00:00
deps: Update win64 openssl provisioning script (#4636)
This commit is contained in:
parent
e622f62d8a
commit
9075d7265c
@ -15,38 +15,6 @@ if (-not (Test-Path $utils)) {
|
|||||||
}
|
}
|
||||||
. $utils
|
. $utils
|
||||||
|
|
||||||
# A helper function to derive the latest VS install and call vcvarsall.bat
|
|
||||||
function Invoke-VcVarsAll {
|
|
||||||
$vsinfo = Get-VSInfo
|
|
||||||
$vsLoc = $vsinfo.location
|
|
||||||
$vsVersion = $vsinfo.version
|
|
||||||
|
|
||||||
if ($vsLoc -ne '') {
|
|
||||||
$vcvarsall = Join-Path $vsLoc 'VC'
|
|
||||||
if ($vsVersion -eq '15') {
|
|
||||||
$vcvarsall = Join-Path $vcvarsall '\Auxiliary\Build\vcvarsall.bat'
|
|
||||||
} else {
|
|
||||||
$vcvarsall = Join-Path $vcvarsall 'vcvarsall.bat'
|
|
||||||
}
|
|
||||||
|
|
||||||
# Lastly invoke the environment provisioning script
|
|
||||||
$null = Invoke-BatchFile "$vcvarsall" "amd64"
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
|
|
||||||
# As a last ditch effort, attempt to find the env variables set by VS2015
|
|
||||||
# in order to derive the location of vcvarsall
|
|
||||||
$vsComnTools = [environment]::GetEnvironmentVariable("VS140COMNTOOLS")
|
|
||||||
if ($vsComnTools -eq '') {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
$vcvarsall = Resolve-Path $(Join-Path "$vsComnTools" "..\..\VC")
|
|
||||||
$vcvarsall = Join-Path $vcvarsall 'vcvarsall.bat'
|
|
||||||
$null = Invoke-BatchFile "$vcvarsall" "amd64"
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# A helper function to call CMake and generate our solution file
|
# A helper function to call CMake and generate our solution file
|
||||||
function Invoke-OsqueryCmake {
|
function Invoke-OsqueryCmake {
|
||||||
$vsinfo = Get-VSInfo
|
$vsinfo = Get-VSInfo
|
||||||
|
@ -30,8 +30,15 @@ $curlCertsShaSum =
|
|||||||
# Invoke our utilities file
|
# Invoke our utilities file
|
||||||
. "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\osquery_utils.ps1"
|
. "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\osquery_utils.ps1"
|
||||||
|
|
||||||
|
# Keep current loc to restore later
|
||||||
|
$currentLoc = Get-Location
|
||||||
|
|
||||||
# Invoke the MSVC developer tools/env
|
# Invoke the MSVC developer tools/env
|
||||||
Invoke-BatchFile "$env:VS140COMNTOOLS\..\..\vc\vcvarsall.bat" amd64
|
$ret = Invoke-VcVarsAll
|
||||||
|
if ($ret -ne $true) {
|
||||||
|
Write-Host "[-] vcvarsall.bat failed to run" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
if (-not
|
if (-not
|
||||||
(
|
(
|
||||||
@ -46,7 +53,8 @@ if (-not
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check that Perl is installed
|
# Check that Perl is installed
|
||||||
if (-not (Get-Command 'perl' -ErrorAction SilentlyContinue)) {
|
$checkPerl = Get-Command 'perl' -ErrorAction SilentlyContinue
|
||||||
|
if (-not ($checkPerl -and $checkPerl.Source.StartsWith('C:\Perl64\bin\'))) {
|
||||||
$msg = "[-] This build requires perl which was not found. Please install " +
|
$msg = "[-] This build requires perl which was not found. Please install " +
|
||||||
"perl from http://www.activestate.com/activeperl/downloads and add " +
|
"perl from http://www.activestate.com/activeperl/downloads and add " +
|
||||||
"to the SYSTEM path before continuing"
|
"to the SYSTEM path before continuing"
|
||||||
@ -88,18 +96,26 @@ if (-not (Test-Path $zipFile)) {
|
|||||||
Invoke-WebRequest $url -OutFile "$zipFile"
|
Invoke-WebRequest $url -OutFile "$zipFile"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$7z = (Get-Command '7z' -ErrorAction SilentlyContinue).Source
|
||||||
|
$7zargs = @(
|
||||||
|
'x',
|
||||||
|
$zipFile
|
||||||
|
)
|
||||||
|
$perl = (Get-Command 'perl' -ErrorAction SilentlyContinue).Source
|
||||||
|
$nmake = (Get-Command 'nmake' -ErrorAction SilentlyContinue).Source
|
||||||
|
|
||||||
# Extract the source
|
# Extract the source
|
||||||
7z x $zipFile
|
Start-OsqueryProcess $7z $7zargs $false
|
||||||
$sourceDir = "$packageName-OpenSSL_$version"
|
$sourceDir = "$packageName-OpenSSL_$version"
|
||||||
Set-Location $sourceDir
|
Set-Location $sourceDir
|
||||||
|
|
||||||
# Build the libraries
|
# Build the libraries
|
||||||
perl Configure VC-WIN64A
|
Start-OsqueryProcess $perl 'Configure VC-WIN64A' $false
|
||||||
ms\do_win64a
|
Invoke-BatchFile 'ms\do_win64a.bat'
|
||||||
nmake -f ms\nt.mak
|
Start-OsqueryProcess $nmake '-f ms\nt.mak' $false
|
||||||
|
|
||||||
#$buildDir = New-Item -Force -ItemType Directory -Path 'osquery-win-build'
|
$buildDir = New-Item -Force -ItemType Directory -Path 'osquery-win-build'
|
||||||
#Set-Location $buildDir
|
Set-Location $buildDir
|
||||||
|
|
||||||
# Construct the Chocolatey Package
|
# Construct the Chocolatey Package
|
||||||
$chocoDir = New-Item -ItemType Directory -Path 'osquery-choco'
|
$chocoDir = New-Item -ItemType Directory -Path 'osquery-choco'
|
||||||
@ -112,9 +128,9 @@ $certsDir = New-Item -ItemType Directory -Path 'local\certs'
|
|||||||
Write-NuSpec $packageName $chocoVersion $authors $owners $projectSource $packageSourceUrl $copyright $license
|
Write-NuSpec $packageName $chocoVersion $authors $owners $projectSource $packageSourceUrl $copyright $license
|
||||||
|
|
||||||
# Copy the libs and headers to their correct location
|
# Copy the libs and headers to their correct location
|
||||||
Copy-Item "..\out32\ssleay32.lib" $libDir
|
Copy-Item "..\..\out32\ssleay32.lib" $libDir
|
||||||
Copy-Item "..\out32\libeay32.lib" $libDir
|
Copy-Item "..\..\out32\libeay32.lib" $libDir
|
||||||
Copy-Item -Recurse "..\inc32\openssl" $includeDir
|
Copy-Item -Recurse "..\..\inc32\openssl" $includeDir
|
||||||
|
|
||||||
# Grab the OpenSSL Curl cert bundle
|
# Grab the OpenSSL Curl cert bundle
|
||||||
Invoke-WebRequest $curlCerts -Outfile "$certsDir\certs.pem"
|
Invoke-WebRequest $curlCerts -Outfile "$certsDir\certs.pem"
|
||||||
@ -132,3 +148,4 @@ if (Test-Path "$packageName.$chocoVersion.nupkg") {
|
|||||||
else {
|
else {
|
||||||
Write-Host "[-] Failed to build $packageName v$chocoVersion." -foregroundcolor Red
|
Write-Host "[-] Failed to build $packageName v$chocoVersion." -foregroundcolor Red
|
||||||
}
|
}
|
||||||
|
Set-Location $currentLoc
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
# in the COPYING file in the root directory of this source tree).
|
# in the COPYING file in the root directory of this source tree).
|
||||||
# You may select, at your option, one of the above-listed licenses.
|
# You may select, at your option, one of the above-listed licenses.
|
||||||
|
|
||||||
|
# Force Powershell to use TLS 1.2
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
# Helper function to add an explicit Deny-Write ACE for the Everyone group
|
# Helper function to add an explicit Deny-Write ACE for the Everyone group
|
||||||
function Set-DenyWriteAcl {
|
function Set-DenyWriteAcl {
|
||||||
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Medium")]
|
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Medium")]
|
||||||
@ -252,3 +255,34 @@ function Get-VSInfo {
|
|||||||
$vsinfo.version = $vsinfo.version.trim()
|
$vsinfo.version = $vsinfo.version.trim()
|
||||||
return $vsinfo
|
return $vsinfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# A helper function to derive the latest VS install and call vcvarsall.bat
|
||||||
|
function Invoke-VcVarsAll {
|
||||||
|
$vsinfo = Get-VSInfo
|
||||||
|
$vsLoc = $vsinfo.location
|
||||||
|
$vsVersion = $vsinfo.version
|
||||||
|
|
||||||
|
if ($vsLoc -ne '') {
|
||||||
|
$vcvarsall = Join-Path $vsLoc 'VC'
|
||||||
|
if ($vsVersion -eq '15') {
|
||||||
|
$vcvarsall = Join-Path $vcvarsall '\Auxiliary\Build\vcvarsall.bat'
|
||||||
|
} else {
|
||||||
|
$vcvarsall = Join-Path $vcvarsall 'vcvarsall.bat'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Lastly invoke the environment provisioning script
|
||||||
|
$null = Invoke-BatchFile "$vcvarsall" "amd64"
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
|
||||||
|
# As a last ditch effort, attempt to find the env variables set by VS2015
|
||||||
|
# in order to derive the location of vcvarsall
|
||||||
|
$vsComnTools = [environment]::GetEnvironmentVariable("VS140COMNTOOLS")
|
||||||
|
if ($vsComnTools -eq '') {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
$vcvarsall = Resolve-Path $(Join-Path "$vsComnTools" "..\..\VC")
|
||||||
|
$vcvarsall = Join-Path $vcvarsall 'vcvarsall.bat'
|
||||||
|
$null = Invoke-BatchFile "$vcvarsall" "amd64"
|
||||||
|
return $true
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user