44 lines
1.7 KiB
PowerShell
44 lines
1.7 KiB
PowerShell
# PowerShell 1-liner installer for Maestri Remote Agent
|
|
# Usage: iwr -useb https://remote.winicomw.ddnsfree.com/install.ps1 | iex
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " Maestri Remote - Instalador de Agente " -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
|
|
# Verifica Node.js
|
|
try {
|
|
$nodeVer = & node --version 2>$null
|
|
Write-Host "[OK] Node.js detectado: $nodeVer" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "[ERRO] Node.js nao encontrado no PATH." -ForegroundColor Red
|
|
Write-Host "Por favor, instale o Node.js v18+ a partir de https://nodejs.org antes de continuar." -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
|
|
$InstallDir = Join-Path $HOME ".maestri-remote"
|
|
if (!(Test-Path $InstallDir)) {
|
|
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
|
|
}
|
|
|
|
$ZipUrl = "https://remote.winicomw.ddnsfree.com/maestri-agent.zip"
|
|
$ZipPath = Join-Path $InstallDir "maestri-agent.zip"
|
|
|
|
Write-Host "`nBaixando pacote do agente de $ZipUrl..." -ForegroundColor Yellow
|
|
Invoke-WebRequest -Uri $ZipUrl -OutFile $ZipPath -UseBasicParsing
|
|
|
|
Write-Host "Extraindo arquivos em $InstallDir..." -ForegroundColor Yellow
|
|
Expand-Archive -Path $ZipPath -DestinationPath $InstallDir -Force
|
|
Remove-Item $ZipPath -Force
|
|
|
|
Set-Location $InstallDir
|
|
Write-Host "Instalando dependencias do agente..." -ForegroundColor Yellow
|
|
& npm install --omit=dev --no-audit --no-fund
|
|
|
|
Write-Host "`n[SUCESSO] Agente instalado com sucesso!" -ForegroundColor Green
|
|
Write-Host "Iniciando o agente local... (Pressione Ctrl+C para encerrar)`n" -ForegroundColor Cyan
|
|
|
|
& node bin/maestri-remote.js start
|