fix: update.ps1 generalisiert fuer stopBat/startBat je Projekt
This commit is contained in:
+24
-8
@@ -1,9 +1,19 @@
|
|||||||
# StatusQuo_Updates/scripts/update.ps1
|
# StatusQuo_Updates/scripts/update.ps1
|
||||||
# Zentraler Updater - wird von update.bat per Invoke-Expression geladen.
|
# Zentraler Updater - wird von update.bat per Invoke-Expression geladen.
|
||||||
# Erwartet im aufrufenden Scope: $proj (Projektname z.B. 'VI3DGL'), $root (Installationspfad)
|
# Erwartet im aufrufenden Scope:
|
||||||
|
# $proj - Projektname (z.B. 'VI3DGL', 'FLD-Schichtplanung', 'DRIVE', 'Portal_Union')
|
||||||
|
# $root - Installationspfad (Verzeichnis mit server.ps1, VERSION usw.)
|
||||||
|
# $stopBat - (optional) Dateiname des Stop-Skripts, z.B. 'DRIVE_Stop.bat'.
|
||||||
|
# Leerstring '' = kein Stop-Schritt. Nicht gesetzt = Fallback auf 'stop.bat'.
|
||||||
|
# $startBat - (optional) Dateiname des Start-Skripts, z.B. 'DRIVE_Start.bat'.
|
||||||
|
# Nicht gesetzt = Fallback auf 'dgl.bat'.
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$DistBase = "https://gitea.rhino.nrw/Rhino/StatusQuo_Updates/raw/branch/main/$proj"
|
$DistBase = "https://gitea.rhino.nrw/Rhino/StatusQuo_Updates/raw/branch/main/$proj"
|
||||||
|
|
||||||
|
# Stop/Start-Namen VOR jeder Ueberschreibung aus dem aufrufenden Scope lesen
|
||||||
|
$_stopName = if ($null -ne $stopBat) { $stopBat } else { 'stop.bat' }
|
||||||
|
$_startName = if ($null -ne $startBat) { $startBat } else { 'dgl.bat' }
|
||||||
|
|
||||||
# Lokale Version lesen
|
# Lokale Version lesen
|
||||||
$localVer = '0.0.0'
|
$localVer = '0.0.0'
|
||||||
$verFile = Join-Path $root 'VERSION'
|
$verFile = Join-Path $root 'VERSION'
|
||||||
@@ -49,10 +59,16 @@ Invoke-WebRequest -Uri "$DistBase/sync-entpacken.bat" -OutFile (Join-Path $tmp '
|
|||||||
|
|
||||||
# Server stoppen
|
# Server stoppen
|
||||||
Write-Host "Stoppe Server ..."
|
Write-Host "Stoppe Server ..."
|
||||||
$stopBat = Join-Path $root 'stop.bat'
|
if ($_stopName -ne '') {
|
||||||
if (Test-Path -LiteralPath $stopBat) {
|
$_stopPath = Join-Path $root $_stopName
|
||||||
& cmd /c "`"$stopBat`""
|
if (Test-Path -LiteralPath $_stopPath) {
|
||||||
|
& cmd /c "`"$_stopPath`""
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
|
} else {
|
||||||
|
Write-Host " (Stop-Skript '$_stopName' nicht gefunden — übersprungen)" -ForegroundColor DarkYellow
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host " (Kein Stop-Skript konfiguriert — übersprungen)" -ForegroundColor DarkYellow
|
||||||
}
|
}
|
||||||
|
|
||||||
# Backup
|
# Backup
|
||||||
@@ -77,12 +93,12 @@ Write-Host "Version auf v$remoteVer aktualisiert." -ForegroundColor Green
|
|||||||
Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
# Server neu starten
|
# Server neu starten
|
||||||
$dglBat = Join-Path $root 'dgl.bat'
|
$_startPath = Join-Path $root $_startName
|
||||||
if (Test-Path -LiteralPath $dglBat) {
|
if (Test-Path -LiteralPath $_startPath) {
|
||||||
Start-Process -FilePath 'cmd.exe' -ArgumentList "/c `"$dglBat`"" -WindowStyle Hidden
|
Start-Process -FilePath 'cmd.exe' -ArgumentList "/c `"$_startPath`"" -WindowStyle Hidden
|
||||||
Write-Host "Server gestartet." -ForegroundColor Green
|
Write-Host "Server gestartet." -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Write-Host "dgl.bat nicht gefunden — bitte Server manuell starten." -ForegroundColor Yellow
|
Write-Host "Start-Skript '$_startName' nicht gefunden — bitte Server manuell starten." -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "=== Update abgeschlossen ===" -ForegroundColor Green
|
Write-Host "=== Update abgeschlossen ===" -ForegroundColor Green
|
||||||
|
|||||||
Reference in New Issue
Block a user