hurl/bin/install_prerequisites_windows.ps1

54 lines
2.1 KiB
PowerShell
Raw Normal View History

2022-12-28 12:20:27 +03:00
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
2023-04-05 12:07:50 +03:00
write-host -foregroundcolor Cyan "----- install system prerequisites -----"
# update vcpkg install
2023-10-20 11:32:57 +03:00
$vcpkg_dir=((Get-command vcpkg).Source | Split-Path)
$lib_dir="$vcpkg_dir\installed\x64-windows\bin"
git -C $vcpkg_dir pull
2022-12-28 02:04:26 +03:00
# install libxml and libcurl[openssl]
2023-10-20 11:32:57 +03:00
vcpkg install --recurse --x-use-aria2 curl[core,non-http,schannel,ssl,sspi,http2]:x64-windows || true
vcpkg install --recurse --x-use-aria2 libxml2[core,iconv]:x64-windows || true
vcpkg update
2022-12-28 12:20:27 +03:00
if ($LASTEXITCODE) { Throw }
vcpkg upgrade --no-dry-run
2022-12-28 12:20:27 +03:00
if ($LASTEXITCODE) { Throw }
vcpkg integrate install
2023-10-20 11:32:57 +03:00
if ($LASTEXITCODE) { Throw }
2023-04-05 12:07:50 +03:00
Set-ItemProperty -Path HKCU:\Environment -Name VCPKGRS_DYNAMIC -Value "1"
$env:VCPKGRS_DYNAMIC = [System.Environment]::GetEnvironmentVariable("VCPKGRS_DYNAMIC","User")
2022-12-28 12:20:27 +03:00
if ($LASTEXITCODE) { Throw }
# update pip
python -m pip install --upgrade pip --quiet
2022-12-28 12:20:27 +03:00
if ($LASTEXITCODE) { Throw }
2023-04-05 12:07:50 +03:00
# install proxy
2023-11-21 13:13:02 +03:00
echo "==== install Squid"
2023-04-05 12:07:50 +03:00
choco install --confirm squid --install-arguments="'TARGETDIR=C:\'"
if ($LASTEXITCODE) { Throw }
2023-11-21 13:13:02 +03:00
echo "==== create log dir integration\build"
New-Item -ItemType Directory -Path integration\build -Force
echo "==== Squid service status"
sc queryex squidsrv | tee -Append -filepath integration\build\proxy.log
echo "==== Squid process status"
Get-Process | Where {$_.Name -eq "Squid"} | tee -Append -filepath integration\build\proxy.log
echo "==== Squid version"
C:\Squid\bin\squid --version | tee -Append -filepath integration\build\proxy.log
echo "==== stop Squid service and kill child process"
taskkill /f /fi "SERVICES eq squidsrv" 2>&1 | tee -Append -filepath integration\build\proxy.log
2023-04-05 12:07:50 +03:00
if ($LASTEXITCODE) { Throw }
2023-11-21 13:13:02 +03:00
taskkill /f /IM squid.exe 2>&1 | tee -Append -filepath integration\build\proxy.log
if ($LASTEXITCODE) { Throw }
echo "==== Squid service status"
sc queryex squidsrv | tee -Append -filepath integration\build\proxy.log
echo "==== Squid process status"
Get-Process | Where {$_.Name -eq "Squid"} | tee -Append -filepath integration\build\proxy.log
2024-04-05 11:16:07 +03:00
# install jq
echo "==== install jq"
choco install --confirm jq
if ($LASTEXITCODE) { Throw }