feat: add deploy script for boogie
This commit is contained in:
1 parent
76e45ac9ad
commit
6dcc315d25
2 files changed
+56
No files matched your search
@@ -0,0 +1,45 @@
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$perspektivwerkSource = Join-Path $projectRoot 'public/perspektivwerk'
|
||||
$remoteTarget = 'boogie:/home/boogie/html/perspektivwerk/'
|
||||
|
||||
if (-not (Test-Path -LiteralPath $perspektivwerkSource -PathType Container)) {
|
||||
throw "Der zu übertragende Ordner '$perspektivwerkSource' wurde nicht gefunden."
|
||||
}
|
||||
|
||||
$sourceItems = @(Get-ChildItem -LiteralPath $perspektivwerkSource -Force)
|
||||
if ($sourceItems.Count -eq 0) {
|
||||
throw "Der zu übertragende Ordner '$perspektivwerkSource' enthält keine Dateien."
|
||||
}
|
||||
|
||||
if (-not (Get-Command scp -ErrorAction SilentlyContinue)) {
|
||||
throw 'OpenSSH scp wurde nicht gefunden. Installiere den OpenSSH-Client oder füge ihn zum PATH hinzu.'
|
||||
}
|
||||
|
||||
if (-not (Get-Command ssh -ErrorAction SilentlyContinue)) {
|
||||
throw 'OpenSSH ssh wurde nicht gefunden. Installiere den OpenSSH-Client oder füge ihn zum PATH hinzu.'
|
||||
}
|
||||
|
||||
Write-Host 'Zielverzeichnisse auf dem Server:'
|
||||
Write-Host " $perspektivwerkSource\* -> $remoteTarget"
|
||||
|
||||
Write-Host "Übertrage ausschließlich die statische Perspektivwerk-Seite nach $remoteTarget"
|
||||
Write-Host 'SCP-Upload und anschließende Rechtekorrektur benötigen jeweils eine SSH-Verbindung.'
|
||||
|
||||
& scp -r @sourceItems $remoteTarget
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Der Upload nach '$remoteTarget' ist fehlgeschlagen (scp Exit-Code $LASTEXITCODE)."
|
||||
}
|
||||
|
||||
Write-Host 'Setze Lese- und Durchsuchrechte auf dem hochgeladenen Ordner.'
|
||||
& ssh boogie 'chmod -R a+rX /home/boogie/html/perspektivwerk'
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Der Upload war erfolgreich, aber die Rechtekorrektur ist fehlgeschlagen (ssh Exit-Code $LASTEXITCODE)."
|
||||
}
|
||||
|
||||
Write-Host 'Upload und Rechtekorrektur abgeschlossen: /home/boogie/html/perspektivwerk/ (inklusive js/booking.js).'
|
||||
Reference in new issue
Block a user