Update install.ps1

This commit is contained in:
FusionPBX
2017-12-31 01:47:59 -07:00
committed by GitHub
parent 2f13faa427
commit de03dc3932

View File

@@ -1,4 +1,4 @@
# FusionPBX Settings # FusionPBX Settings
$domain_name = "hostname" # hostname, ip_address or a custom value $domain_name = "hostname" # hostname, ip_address or a custom value
$system_username = "admin" # default username admin $system_username = "admin" # default username admin
$system_password = "random" # random or a custom value $system_password = "random" # random or a custom value
@@ -14,7 +14,8 @@ $switch_version = "1.6" # *1.6.*
$database_password = "random" # random or a custom value $database_password = "random" # random or a custom value
#$database_backup = $false # true or false #$database_backup = $false # true or false
# Web server # General Settings
$cpu = "x64" # x64 or x86
$php_version = 7 # PHP version 5 or 7 $php_version = 7 # PHP version 5 or 7
$web_server = "IIS" # nginx or IIS $web_server = "IIS" # nginx or IIS
$iis_identity = "LocalSystem" # localSystem or NetworkService $iis_identity = "LocalSystem" # localSystem or NetworkService
@@ -42,15 +43,6 @@ Function Get-Link([string]$url, [string]$pattern) {
return $uri.AbsoluteUri return $uri.AbsoluteUri
} }
Function Get-CPU() {
if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
Return "x86"
}
else {
Return "x64"
}
}
Function Write-Log([string]$message) { Function Write-Log([string]$message) {
Add-Content -Path "install.log" -Value $message Add-Content -Path "install.log" -Value $message
Write-Host $message -ForegroundColor Cyan Write-Host $message -ForegroundColor Cyan
@@ -67,7 +59,7 @@ Function Get-InstalledApp([string]$name) {
#Download and install latest version on FreeSWITCH 1.6. #Download and install latest version on FreeSWITCH 1.6.
#Set it to auto start #Set it to auto start
Function Install-FreeSWITCH() { Function Install-FreeSWITCH() {
if (Get-CPU -eq "x86") { if ($cpu -eq "x86") {
$url = "http://files.freeswitch.org/windows/installer/x86/" $url = "http://files.freeswitch.org/windows/installer/x86/"
} }
else { else {
@@ -95,7 +87,6 @@ Function Install-FreeSWITCH() {
#mod_lua.dll is missing from recent windows builds #mod_lua.dll is missing from recent windows builds
$lua = "C:\Program Files\FreeSWITCH\mod\mod_lua.dll" $lua = "C:\Program Files\FreeSWITCH\mod\mod_lua.dll"
if ( -not (Test-Path $lua) ) { if ( -not (Test-Path $lua) ) {
$cpu = Get-CPU
Get-File "https://raw.github.com/sergey-mz/fusionpbx-install.sh/master/windows/resources/$cpu/mod_lua.dll" Get-File "https://raw.github.com/sergey-mz/fusionpbx-install.sh/master/windows/resources/$cpu/mod_lua.dll"
Copy-Item ".\mod_lua.dll" -Destination $lua Copy-Item ".\mod_lua.dll" -Destination $lua
} }
@@ -133,7 +124,7 @@ Function Expand-ZIP([string]$filename) {
Function Install-PostgresODBC() { Function Install-PostgresODBC() {
$url = "https://ftp.postgresql.org/pub/odbc/versions/msi/" $url = "https://ftp.postgresql.org/pub/odbc/versions/msi/"
$link = Get-Link $url -pattern "*" + (Get-CPU) + "*" $link = Get-Link $url -pattern "*" + ($cpu) + "*"
Write-Host Download ODBC from $link -ForegroundColor Cyan Write-Host Download ODBC from $link -ForegroundColor Cyan
$filename = Get-File $link $filename = Get-File $link
Expand-ZIP $filename Expand-ZIP $filename
@@ -164,10 +155,12 @@ Function Install-PostgresODBC() {
else { else {
# Configure DSN with ODBC Administrator # Configure DSN with ODBC Administrator
Write-Host The ODBC Administrator window will open. -ForegroundColor Yellow Write-Host The ODBC Administrator window will open. -ForegroundColor Yellow
if (Get-CPU -eq "x86") { if ($cpu -eq "x86") {
$driver="PostgreSQL Unicode" } $driver="PostgreSQL Unicode"
}
else { else {
$driver="PostgreSQL Unicode(x64)" } $driver="PostgreSQL Unicode(x64)"
}
#ODBCCONF.EXE /Lv dsn_log.txt CONFIGSYSDSN "$driver" "DSN=fusionpbx|server=localhost|port=5432|database=fusionpbx|Username=postgres|password=$database_password" #ODBCCONF.EXE /Lv dsn_log.txt CONFIGSYSDSN "$driver" "DSN=fusionpbx|server=localhost|port=5432|database=fusionpbx|Username=postgres|password=$database_password"
ODBCCONF.EXE /Lv dsn_log.txt CONFIGSYSDSN "$driver" "DSN=fusionpbx|server=localhost|port=5432|database=fusionpbx|Username=postgres|password=$database_password|GssAuthUseGSS=false" ODBCCONF.EXE /Lv dsn_log.txt CONFIGSYSDSN "$driver" "DSN=fusionpbx|server=localhost|port=5432|database=fusionpbx|Username=postgres|password=$database_password|GssAuthUseGSS=false"
} }
@@ -242,7 +235,7 @@ Function Install-PostgreSQL() {
} }
Function Install-Git(){ Function Install-Git(){
if ($env:PROCESSOR_ARCHITECTURE -eq "x86") { if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
Ω $url = "https://github.com/git-for-windows/git/releases/download/v2.15.1.windows.2/Git-2.15.1.2-32-bit.exe" $url = "https://github.com/git-for-windows/git/releases/download/v2.15.1.windows.2/Git-2.15.1.2-32-bit.exe"
} }
else { else {
$url = "https://github.com/git-for-windows/git/releases/download/v2.15.1.windows.2/Git-2.15.1.2-64-bit.exe" $url = "https://github.com/git-for-windows/git/releases/download/v2.15.1.windows.2/Git-2.15.1.2-64-bit.exe"
@@ -286,7 +279,6 @@ Function Install-FusionPBX() {
-replace "{domain_name}",$domain_name ` -replace "{domain_name}",$domain_name `
-replace "{v_project_path}","" ` -replace "{v_project_path}","" `
-replace "{v_user}:{v_pass}",((New-Password 8) + ":" + (New-Password 8)) | Out-File $filename -replace "{v_user}:{v_pass}",((New-Password 8) + ":" + (New-Password 8)) | Out-File $filename
} }
Function Install-IIS([string]$path) { Function Install-IIS([string]$path) {
@@ -370,7 +362,6 @@ Function Install-Nginx() {
Start-Process "C:\Program Files\7-Zip\7z.exe" "e $filename" -Wait Start-Process "C:\Program Files\7-Zip\7z.exe" "e $filename" -Wait
Set-Location "C:/nginx" Set-Location "C:/nginx"
} }
#[System.Environment]::OSVersion.Version.Major #[System.Environment]::OSVersion.Version.Major