mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
PostgreSQL install on Ubuntu/Windows. (#636)
* added windows installation script for postgresql * removed if from Start-PostreSQL * added script to packar template. * changed postgresql.sh for ubuntu. * postgresql stop and disalbe services. * change name of the functions * Stop postgreSQL after validation instead of start. * added validation and re-work installation prcoedur * remove redundunt code from psql * correct intendation * path to Path * added PostgreSQL validation procedure. * Removed useless last line. * redundunt parameter passed in function call. * removed repeated part of code. * removed Stop function since it was useless. * spaces * spaces = * Update Windows2019-Azure.json * resolve confictls * added validate and install postgresql * added password to choco install and variables. * add new system variables. * added --params flag * added correct quotas * added logging for PostgreSQL install Co-authored-by: Dariy.Nurgaleev <d.nurgaleev@trueengineering.ru>
This commit is contained in:
35
images/win/scripts/Installers/Validate-PostgreSQL.ps1
Normal file
35
images/win/scripts/Installers/Validate-PostgreSQL.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
$PGUSER="postgres"
|
||||
function Validate-PostgreSQL {
|
||||
$pgready = Start-Process -FilePath pg_isready -Wait -PassThru
|
||||
$exitCode = $pgready.ExitCode
|
||||
if ($exitCode -eq 0)
|
||||
{
|
||||
Write-Host -Object "PostgreSQL has been successfully installed."
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode"
|
||||
exit $exitCode
|
||||
}
|
||||
}
|
||||
|
||||
$paths = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
|
||||
$pgservice = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").Name
|
||||
$pgroot = $paths.split('"')[1].replace("\bin\pg_ctl.exe", "")
|
||||
$psqlVersion = pg_config --version | Out-String
|
||||
Validate-PostgreSQL
|
||||
|
||||
# Adding description of the software to Markdown
|
||||
$SoftwareName = "PostgreSQL"
|
||||
$Description = @"
|
||||
_Version:_ $psqlVersion<br/>
|
||||
_Default Path:_ $pgroot<br/>
|
||||
_User:_ $env:PGUSER<br/>
|
||||
_Password:_ $env:PGPASSWORD
|
||||
"@
|
||||
|
||||
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
|
||||
|
||||
#Stop and disable PostgreSQL service
|
||||
Stop-Service -Name $pgservice
|
||||
Set-Service $pgservice -StartupType Disabled
|
||||
Reference in New Issue
Block a user