Update the Windows install.

This commit is contained in:
markjcrane
2018-01-03 01:13:29 -07:00
parent 4829f22abf
commit 74abcb8196
26 changed files with 655 additions and 484 deletions

View File

@@ -0,0 +1,34 @@
Function Install-PostgreSQL() {
. .\resources\get-file.ps1
. .\resources\get-database_password.ps1
. .\resources\start-pgsql.ps1
. .\resources\get-installed-app.ps1
if (Get-Installed-App "PostgreSQL*") {
Write-Host PostgreSQL is already installed
return
}
if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
$url = "https://get.enterprisedb.com/postgresql/postgresql-10.1-3-windows.exe"
}
else {
$url = "https://get.enterprisedb.com/postgresql/postgresql-10.1-3-windows-x64.exe"
}
Write-Host Download PostgreSQL from $url -ForegroundColor Cyan
$filename = Get-File $url
Write-Host Install Postgresql -ForegroundColor Cyan
Start-Process $filename "--mode unattended --superpassword $database_password" -Wait
#Get-Service postgre*
Write-Host "Create the database and users" -ForegroundColor Cyan
Start-PSQL "CREATE DATABASE fusionpbx;";
Start-PSQL "CREATE DATABASE freeswitch;";
Start-PSQL "CREATE ROLE fusionpbx WITH SUPERUSER LOGIN PASSWORD '$database_password';"
Start-PSQL "CREATE ROLE freeswitch WITH SUPERUSER LOGIN PASSWORD '$database_password';"
Start-PSQL "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;"
Start-PSQL "GRANT ALL PRIVILEGES ON DATABASE freeswitch to fusionpbx;"
Start-PSQL "GRANT ALL PRIVILEGES ON DATABASE freeswitch to freeswitch;"
}