forked from norman/fusionpbx-install.sh-github-mirror
Update the Windows install.
This commit is contained in:
34
windows/resources/install-postgresql.ps1
Normal file
34
windows/resources/install-postgresql.ps1
Normal 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;"
|
||||
}
|
||||
Reference in New Issue
Block a user