Files
cameleer-saas/get-cameleer.ps1

65 lines
1.8 KiB
PowerShell
Raw Normal View History

#Requires -Version 5.1
<#
.SYNOPSIS
Bootstrap script downloads the Cameleer installer and runs it.
.EXAMPLE
irm https://gitea.siegeln.net/cameleer/cameleer-saas/raw/branch/main/get-cameleer.ps1 | iex
.\get-cameleer.ps1 -Version v1.2.0
#>
param(
[string]$Version,
[string]$Ref,
[switch]$Run
)
$ErrorActionPreference = 'Stop'
$Repo = 'https://gitea.siegeln.net/cameleer/cameleer-saas/raw'
if ($Version) { $RefPath = "tag/$Version" }
elseif ($Ref) { $RefPath = "branch/$Ref" }
else { $RefPath = 'branch/main' }
$Base = "$Repo/$RefPath"
$Dir = '.\installer'
$Files = @(
'installer/install.sh'
'installer/install.ps1'
'installer/templates/docker-compose.yml'
'installer/templates/docker-compose.saas.yml'
'installer/templates/docker-compose.server.yml'
'installer/templates/docker-compose.tls.yml'
'installer/templates/docker-compose.monitoring.yml'
'installer/templates/traefik-dynamic.yml'
'installer/templates/.env.example'
)
Write-Host 'Downloading Cameleer installer...'
New-Item -ItemType Directory -Path "$Dir\templates" -Force | Out-Null
foreach ($file in $Files) {
$localPath = Join-Path $Dir ($file -replace '^installer/', '')
$localDir = Split-Path $localPath -Parent
if (-not (Test-Path $localDir)) { New-Item -ItemType Directory -Path $localDir -Force | Out-Null }
Write-Host " $($file -replace '^installer/', '')"
try {
Invoke-WebRequest -Uri "$Base/$file" -OutFile $localPath -UseBasicParsing
} catch {
# install.ps1 may not exist yet — skip gracefully
if ($file -match 'install\.ps1$') { continue }
throw
}
}
Write-Host ''
Write-Host "Installer ready in $Dir\"
Write-Host 'Run: cd installer; .\install.ps1'
Write-Host ''
if ($Run) {
Set-Location $Dir
& .\install.ps1 @args
}