Merge pull request #11047 from lawrencegripper/lg/postgres-win-update

[Windows] Unpin Postgres allowing latest v14 version
This commit is contained in:
Lawrence Gripper
2025-01-21 12:30:37 +00:00
committed by GitHub
4 changed files with 36 additions and 7 deletions

View File

@@ -58,13 +58,24 @@ if ($null -ne ($toolsetVersion | Select-String -Pattern '\d+\.\d+\.\d+')) {
} while (!$response)
}
if ((Get-ToolsetContent).postgresql.installVcRedist) {
# Postgres 14 requires the vs 17 redistributable
$vs17RedistUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
Install-Binary `
-Url $vs17RedistUrl `
-InstallArgs @("/install", "/quiet", "/norestart") `
-ExpectedSignature (Get-ToolsetContent).postgresql.vcRedistSignature
}
# Return the previous value of ErrorAction and invoke Install-Binary function
$ErrorActionPreference = $errorActionOldValue
$installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended")
Install-Binary `
-Url $installerUrl `
-InstallArgs $installerArgs `
-ExpectedSignature (Get-ToolsetContent).postgresql.signature
-ExpectedSignature (Get-ToolsetContent).postgresql.signature `
-InstallerLogPath "$env:TEMP\**\install-postgresql.log"
# Get Path to pg_ctl.exe
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName

View File

@@ -30,6 +30,10 @@ function Install-Binary {
.PARAMETER ExpectedSHA512Sum
The expected SHA512 sum of the binary. If specified, the binary's SHA512 sum is checked before installation.
.PARAMETER InstallerLogPath
The path to the log file which is produced when the installation fails. This can be used for debugging purposes.
This is only displayed when the installation fails.
.EXAMPLE
Install-Binary -Url "https://go.microsoft.com/fwlink/p/?linkid=2083338" -Type EXE -InstallArgs ("/features", "+", "/quiet") -ExpectedSignature "A5C7D5B7C838D5F89DDBEDB85B2C566B4CDA881F"
#>
@@ -46,7 +50,8 @@ function Install-Binary {
[String[]] $ExtraInstallArgs,
[String[]] $ExpectedSignature,
[String] $ExpectedSHA256Sum,
[String] $ExpectedSHA512Sum
[String] $ExpectedSHA512Sum,
[String] $InstallerLogPath
)
if ($PSCmdlet.ParameterSetName -eq "LocalPath") {
@@ -122,6 +127,15 @@ function Install-Binary {
} else {
Write-Host "Installation process returned unexpected exit code: $exitCode"
Write-Host "Time elapsed: $installCompleteTime seconds"
if ($InstallerLogPath) {
Write-Host "Searching for logs maching $InstallerLogPath pattern"
Get-ChildItem -Recurse -Path $InstallerLogPath | ForEach-Object {
Write-Output "Found Installer Log: $InstallerLogPath"
Write-Output "File content:"
Get-Content -Path $_.FullName
}
}
exit $exitCode
}
} catch {

View File

@@ -412,8 +412,8 @@
"choco": {
"common_packages": [
{ "name": "7zip.install" },
{ "name": "aria2" },
{ "name": "azcopy10" },
{ "name": "aria2" },
{ "name": "Bicep" },
{ "name": "gitversion.portable"},
{ "name": "innosetup" },
@@ -462,8 +462,10 @@
"version": "18"
},
"postgresql": {
"version": "14.12.1",
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9",
"version": "14",
"vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D",
"installVcRedist": true
},
"kotlin": {
"version": "latest"

View File

@@ -372,8 +372,10 @@
"version": "8.3"
},
"postgresql": {
"version": "14.12.1",
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9",
"version": "14",
"vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D",
"installVcRedist": true
},
"kotlin": {
"version": "latest"