Fixed Issues in Borealis.ps1 and Update.ps1

This commit is contained in:
2025-10-19 17:44:42 -06:00
parent 2c061bc6d1
commit 458ad7af4a
4 changed files with 313 additions and 23 deletions

View File

@@ -1030,13 +1030,40 @@ switch ($choice) {
Run-Step "Create Borealis Virtual Python Environment" {
if (-not (Test-Path "$venvFolder\Scripts\Activate")) { & $pythonExe -m venv $venvFolder | Out-Null }
if (Test-Path $dataSource) {
Remove-Item $dataDestination -Recurse -Force -ErrorAction SilentlyContinue
$preserveItems = @('auth_keys','server_secret.key','cache')
$preserveRoot = Join-Path $venvFolder '.__borealis_preserve'
if (Test-Path $dataDestination) {
Remove-Item $preserveRoot -Recurse -Force -ErrorAction SilentlyContinue
New-Item -Path $preserveRoot -ItemType Directory -Force | Out-Null
foreach ($item in $preserveItems) {
$sourcePath = Join-Path $dataDestination $item
if (Test-Path $sourcePath) {
$targetPath = Join-Path $preserveRoot $item
$targetParent = Split-Path $targetPath -Parent
if (-not (Test-Path $targetParent)) {
New-Item -Path $targetParent -ItemType Directory -Force | Out-Null
}
Move-Item -Path $sourcePath -Destination $targetPath -Force
}
}
Remove-Item $dataDestination -Recurse -Force -ErrorAction SilentlyContinue
}
New-Item -Path $dataDestination -ItemType Directory -Force | Out-Null
Copy-Item "$dataSource\Server\Python_API_Endpoints" $dataDestination -Recurse
Copy-Item "$dataSource\Server\Sounds" $dataDestination -Recurse
Copy-Item "$dataSource\Server\Modules" $dataDestination -Recurse
Copy-Item "$dataSource\Server\server.py" $dataDestination
Copy-Item "$dataSource\Server\job_scheduler.py" $dataDestination
if (Test-Path $preserveRoot) {
Get-ChildItem -Path $preserveRoot -Force | ForEach-Object {
$target = Join-Path $dataDestination $_.Name
if (Test-Path $target) {
Remove-Item $target -Recurse -Force -ErrorAction SilentlyContinue
}
Move-Item -Path $_.FullName -Destination $target -Force
}
Remove-Item $preserveRoot -Recurse -Force -ErrorAction SilentlyContinue
}
}
. "$venvFolder\Scripts\Activate"
}