Files

45 lines
1.3 KiB
PowerShell

$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$sourceDir = Join-Path $repoRoot "sternwarte-homeassistant-card\dist"
$targetDir = "\\192.168.1.71\config\www"
$files = @(
"sternwarte-card.js",
"astronomy.browser.min.js",
"moon_small.png"
)
if (-not (Test-Path -LiteralPath $sourceDir)) {
throw "Quellordner nicht gefunden: $sourceDir"
}
if (-not (Test-Path -LiteralPath $targetDir)) {
throw "Zielordner nicht erreichbar: $targetDir"
}
Write-Host "Kopiere Dateien nach $targetDir ..." -ForegroundColor Cyan
foreach ($file in $files) {
$sourcePath = Join-Path $sourceDir $file
$targetPath = Join-Path $targetDir $file
if (-not (Test-Path -LiteralPath $sourcePath)) {
throw "Quelldatei nicht gefunden: $sourcePath"
}
Copy-Item -LiteralPath $sourcePath -Destination $targetPath -Force
$sourceHash = (Get-FileHash -LiteralPath $sourcePath -Algorithm SHA256).Hash
$targetHash = (Get-FileHash -LiteralPath $targetPath -Algorithm SHA256).Hash
if ($sourceHash -ne $targetHash) {
throw "Hash-Prüfung fehlgeschlagen für $file"
}
Write-Host "OK $file" -ForegroundColor Green
}
Write-Host ""
Write-Host "Deploy abgeschlossen." -ForegroundColor Green
Write-Host "Bitte das Home-Assistant-Frontend hart neu laden." -ForegroundColor Yellow