-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild_all.ps1
More file actions
89 lines (72 loc) · 3.21 KB
/
Copy pathbuild_all.ps1
File metadata and controls
89 lines (72 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
$ErrorActionPreference = "Stop"
$root = Get-Location
Write-Host ">>> Building DesktopServerLite (Standard)..." -ForegroundColor Magenta
Set-Location "$root\Lite"
.\build.ps1
Write-Host ">>> Building DesktopServerPro (Pro)..." -ForegroundColor Magenta
Set-Location "$root\Pro"
.\build.ps1
Write-Host ">>> Building DesktopServerGo (Go)..." -ForegroundColor Magenta
Set-Location "$root\Go"
.\build.ps1
Set-Location $root
Write-Host ">>> Preparing Deploy Directory..." -ForegroundColor Magenta
if (Test-Path ".\Deploy") { Remove-Item ".\Deploy\*" -Force }
else { New-Item -ItemType Directory ".\Deploy" | Out-Null }
Write-Host ">>> Copying Installers to Deploy Folder..." -ForegroundColor Magenta
$src1 = ".\Lite\Publish\DesktopServerSetupLite.exe"
if (Test-Path $src1) {
Copy-Item $src1 ".\Deploy\DesktopServerSetupLite.exe" -Force
Write-Host " Copied DesktopServerSetupLite.exe to Deploy\" -ForegroundColor Green
} else {
Write-Error " DesktopServerSetupLite.exe not found!"
}
$src2 = ".\Pro\Publish\DesktopServerSetupPro.exe"
if (Test-Path $src2) {
Copy-Item $src2 ".\Deploy\DesktopServerSetupPro.exe" -Force
Write-Host " Copied DesktopServerSetupPro.exe to Deploy\" -ForegroundColor Green
} else {
Write-Error " DesktopServerSetupPro.exe not found!"
}
$src3 = ".\Go\Publish\DesktopServerSetupGo.exe"
if (Test-Path $src3) {
Copy-Item $src3 ".\Deploy\DesktopServerSetupGo.exe" -Force
Write-Host " Copied DesktopServerSetupGo.exe to Deploy\" -ForegroundColor Green
} else {
Write-Error " DesktopServerSetupGo.exe not found!"
}
# Helper for safe archiving to prevent locking issues
function Safe-Archive($source, $destZip, $dest7z) {
if (-not (Test-Path $source)) { return }
$maxRetries = 3
$retryCount = 0
$success = $false
while (-not $success -and $retryCount -lt $maxRetries) {
try {
Write-Host " Processing: $(Split-Path $source -Leaf)..." -ForegroundColor Gray
Start-Sleep -Seconds 2 # Give OS/Antivirus a moment
# Zip Archive
Compress-Archive -Path $source -DestinationPath $destZip -Force
# 7z Archive
if (Test-Path $sevenZip) {
& $sevenZip a -t7z $dest7z $source | Out-Null
}
$success = $true
}
catch {
$retryCount++
if ($retryCount -lt $maxRetries) {
Write-Host " Locked! Retrying in 2s... ($retryCount/$maxRetries)" -ForegroundColor Yellow
Start-Sleep -Seconds 2
} else {
Write-Error " Failed to archive $source after $maxRetries attempts."
}
}
}
}
Write-Host ">>> Generating Archives..." -ForegroundColor Magenta
$sevenZip = "C:\Program Files\7-Zip\7z.exe"
Safe-Archive ".\Deploy\DesktopServerSetupLite.exe" ".\Deploy\DesktopServerSetupLite.zip" ".\Deploy\DesktopServerSetupLite.7z"
Safe-Archive ".\Deploy\DesktopServerSetupPro.exe" ".\Deploy\DesktopServerSetupPro.zip" ".\Deploy\DesktopServerSetupPro.7z"
Safe-Archive ".\Deploy\DesktopServerSetupGo.exe" ".\Deploy\DesktopServerSetupGo.zip" ".\Deploy\DesktopServerSetupGo.7z"
Write-Host "All Done! Final artifacts available in .\Deploy" -ForegroundColor Green