$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
if ($PSVersionTable.PSEdition -eq 'Desktop') {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
$baseUrl = if ($env:BOT_FORGE_BASE_URL) {
$env:BOT_FORGE_BASE_URL.TrimEnd('/')
} else {
'https://REPLACE-WITH-INTERNAL-SERVER/bot-forge'
}
$checksumsSha256 = 'b32e6218fe36a2b696fc554ce46142d502d1458ea96c4ee7d99bdd78ceea68dd'
$architecture = try {
[System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()
} catch {
if ($env:PROCESSOR_ARCHITEW6432) {
$env:PROCESSOR_ARCHITEW6432
} else {
$env:PROCESSOR_ARCHITECTURE
}
}
if ($architecture -notin 'X64', 'AMD64') {
if ($architecture -in 'Arm64', 'ARM64') {
throw 'This deployment does not provide a Windows ARM64 binary.'
}
throw "Unsupported Windows architecture: $architecture"
}
$temporaryInstaller = Join-Path ([System.IO.Path]::GetTempPath()) "bot-forge-install-$PID-$([guid]::NewGuid().ToString('N')).ps1"
try {
Invoke-WebRequest -UseBasicParsing -Uri "$baseUrl/install.ps1" -OutFile $temporaryInstaller
$env:BOT_FORGE_BASE_URL = $baseUrl
$env:BOT_FORGE_CHECKSUMS_SHA256 = $checksumsSha256
& $temporaryInstaller advanced
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
} finally {
Remove-Item -LiteralPath $temporaryInstaller -Force -ErrorAction SilentlyContinue
}