Atualizacao Pilot_Installer_Utilities
This commit is contained in:
@@ -312,61 +312,200 @@ function Disable-UACAndNotifications {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Upgrade-PortraitCabTab {
|
function Upgrade-PortraitCabTab {
|
||||||
Initialize-SystemConfiguration
|
|
||||||
|
|
||||||
Initialize-SystemConfiguration
|
$OriginalLocation = Get-Location
|
||||||
|
|
||||||
Write-Log "`nSetting main connection as PRIVATE..."
|
$CabTabPath = "C:\PilotDownloads\CabTabInstall"
|
||||||
Get-NetConnectionProfile |
|
$PilotPath = "C:\pilotgames"
|
||||||
Where-Object { $_.InterfaceAlias -like "*Ethernet*" } |
|
$DownloadsPath = Join-Path $PilotPath "downloads"
|
||||||
Set-NetConnectionProfile -NetworkCategory Private
|
|
||||||
|
function Invoke-Step {
|
||||||
|
|
||||||
|
param(
|
||||||
|
[string]$Description,
|
||||||
|
[scriptblock]$Command
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Log ""
|
||||||
|
Write-Log "========================================"
|
||||||
|
Write-Log $Description
|
||||||
|
|
||||||
Write-Log "`nAdjusting System Time..."
|
|
||||||
try {
|
try {
|
||||||
Set-Service w32time -StartupType Automatic -ErrorAction SilentlyContinue
|
|
||||||
Start-Service w32time -ErrorAction SilentlyContinue
|
& $Command
|
||||||
w32tm /resync /force | Out-Null
|
|
||||||
Write-Log "System time synchronized."
|
Write-Log "[ OK ] $Description"
|
||||||
} catch {
|
|
||||||
Write-Log "Could not synchronize system time: $_"
|
}
|
||||||
|
catch {
|
||||||
|
|
||||||
|
Write-Log "[ERRO] $Description"
|
||||||
|
Write-Log $_
|
||||||
|
|
||||||
|
throw
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-Location C:\PilotDownloads\CabTabInstall
|
}
|
||||||
Copy-Item credentials.dat C:\pilotgames\ -Force
|
|
||||||
Copy-Item deployAgent.bat C:\pilotgames\ -Force
|
try {
|
||||||
Copy-Item deployCabinet.bat C:\pilotgames\ -Force
|
|
||||||
Copy-Item site_director.cfg C:\pilotgames\ -Force
|
Initialize-SystemConfiguration
|
||||||
Copy-Item start.bat C:\pilotgames\ -Force
|
|
||||||
Copy-Item OHGDRelease-2026.05.07.1.zip C:\pilotgames\downloads\ -Force
|
foreach ($Path in @($CabTabPath,$PilotPath,$DownloadsPath)) {
|
||||||
Copy-Item PilotGameAgentRelease-2026.6.2.1.zip C:\pilotgames\downloads\ -Force
|
|
||||||
|
if (!(Test-Path $Path)) {
|
||||||
|
throw "Pasta não encontrada: $Path"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Set-Location $CabTabPath
|
||||||
|
Write-Log "Diretório atual: $(Get-Location)"
|
||||||
|
|
||||||
|
Invoke-Step "Copiando credentials.dat" {
|
||||||
|
Copy-Item ".\credentials.dat" $PilotPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Copiando deployAgent.bat" {
|
||||||
|
Copy-Item ".\deployAgent.bat" $PilotPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Copiando deployCabinet.bat" {
|
||||||
|
Copy-Item ".\deployCabinet.bat" $PilotPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Copiando site_director.cfg" {
|
||||||
|
Copy-Item ".\site_director.cfg" $PilotPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Copiando start.bat" {
|
||||||
|
Copy-Item ".\start.bat" $PilotPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Copiando OHGDRelease" {
|
||||||
|
Copy-Item ".\OHGDRelease-2026.05.07.1.zip" $DownloadsPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Copiando PilotGameAgentRelease" {
|
||||||
|
Copy-Item ".\PilotGameAgentRelease-2026.6.2.1.zip" $DownloadsPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Importando configurações do registro" {
|
||||||
reg import "PG Settings.reg"
|
reg import "PG Settings.reg"
|
||||||
Start-Process windowsdesktop-runtime-8.0.15-win-x64.exe -ArgumentList "/quiet /norestart" -Wait
|
}
|
||||||
|
|
||||||
Remove-Item C:\pilot -Recurse -Force -ErrorAction SilentlyContinue
|
Invoke-Step "Instalando .NET Desktop Runtime" {
|
||||||
|
|
||||||
Set-Location C:\pilotgames
|
$proc = Start-Process `
|
||||||
net stop PilotGameAgent
|
".\windowsdesktop-runtime-8.0.15-win-x64.exe" `
|
||||||
sc.exe delete PilotGameAgent
|
-ArgumentList "/quiet /norestart" `
|
||||||
|
-Wait `
|
||||||
|
-PassThru
|
||||||
|
|
||||||
Rename-Item game_agent game_agent.ND -ErrorAction SilentlyContinue
|
if ($proc.ExitCode -ne 0) {
|
||||||
New-Item game_agent -ItemType Directory -Force|Out-Null
|
throw "Instalação do Runtime retornou ExitCode $($proc.ExitCode)"
|
||||||
|
}
|
||||||
|
|
||||||
.\deployAgent.bat 2026.6.2.1
|
}
|
||||||
.\InstallGameAgentService.bat
|
|
||||||
|
|
||||||
Set-Service -Name PilotGameAgent -StartupType Automatic
|
Set-Location $PilotPath
|
||||||
|
|
||||||
Remove-Item NDGDRelease*.zip -Force -ErrorAction SilentlyContinue
|
Invoke-Step "Removendo C:\pilot" {
|
||||||
Remove-Item NDGDRelease.bak -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item "C:\pilot" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item BRGDRelease.bak -Recurse -Force -ErrorAction SilentlyContinue
|
}
|
||||||
|
|
||||||
if(Test-Path NDGDRelease){Move-Item NDGDRelease NDGDRelease.bak}
|
Invoke-Step "Parando serviço PilotGameAgent" {
|
||||||
if(Test-Path BRGDRelease){Move-Item BRGDRelease BRGDRelease.bak}
|
Stop-Service PilotGameAgent -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
.\deployCabinet.bat 2026.05.07.1
|
Invoke-Step "Removendo serviço PilotGameAgent" {
|
||||||
|
sc.exe delete PilotGameAgent | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Renomeando game_agent" {
|
||||||
|
|
||||||
|
if (Test-Path ".\game_agent.ND") {
|
||||||
|
Remove-Item ".\game_agent.ND" -Recurse -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path ".\game_agent") {
|
||||||
|
Rename-Item ".\game_agent" "game_agent.ND"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Criando novo diretório game_agent" {
|
||||||
|
New-Item ".\game_agent" -ItemType Directory -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Executando deployAgent" {
|
||||||
|
& ".\deployAgent.bat" "2026.6.2.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Instalando serviço PilotGameAgent" {
|
||||||
|
& ".\InstallGameAgentService.bat"
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Configurando serviço para Automático" {
|
||||||
|
Set-Service PilotGameAgent -StartupType Automatic
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Limpando arquivos antigos" {
|
||||||
|
|
||||||
|
Remove-Item ".\NDGDRelease*.zip" -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item ".\NDGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item ".\BRGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Criando backup das releases" {
|
||||||
|
|
||||||
|
if (Test-Path ".\NDGDRelease") {
|
||||||
|
Move-Item ".\NDGDRelease" ".\NDGDRelease.bak"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path ".\BRGDRelease") {
|
||||||
|
Move-Item ".\BRGDRelease" ".\BRGDRelease.bak"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Executando deployCabinet" {
|
||||||
|
& ".\deployCabinet.bat" "2026.05.07.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Reiniciando Explorer" {
|
||||||
|
taskkill /IM explorer.exe /F | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Step "Iniciando serviço PilotGameAgent" {
|
||||||
|
Start-Service PilotGameAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Log ""
|
||||||
|
Write-Log "========================================"
|
||||||
|
Write-Log "Upgrade Portrait CabTab concluído com sucesso."
|
||||||
|
Write-Log "========================================"
|
||||||
|
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
|
||||||
|
Write-Log ""
|
||||||
|
Write-Log "========================================"
|
||||||
|
Write-Log "FALHA DURANTE O UPGRADE"
|
||||||
|
Write-Log $_
|
||||||
|
Write-Log "========================================"
|
||||||
|
|
||||||
|
throw
|
||||||
|
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
|
||||||
|
Set-Location $OriginalLocation
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
taskkill /IM explorer.exe /F
|
|
||||||
net start PilotGameAgent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# GUI
|
# GUI
|
||||||
|
|||||||
Reference in New Issue
Block a user