Added Tesseract-OCR Persistence through Updates
This commit is contained in:
parent
a19910048b
commit
f73f4b31e0
32
Borealis.ps1
32
Borealis.ps1
@ -490,8 +490,21 @@ switch ($choice) {
|
|||||||
# Prepare paths
|
# Prepare paths
|
||||||
$updateZip = Join-Path $scriptDir "Update_Staging\main.zip"
|
$updateZip = Join-Path $scriptDir "Update_Staging\main.zip"
|
||||||
$updateDir = Join-Path $scriptDir "Update_Staging\borealis"
|
$updateDir = Join-Path $scriptDir "Update_Staging\borealis"
|
||||||
|
$preservePath = Join-Path $scriptDir "Data\Server\Python_API_Endpoints\Tesseract-OCR"
|
||||||
|
$preserveBackupPath = Join-Path $scriptDir "Update_Staging\Tesseract-OCR"
|
||||||
|
|
||||||
|
Run-Step "Updating: Move Tesseract-OCR Folder Somewhere Safe to Restore Later" {
|
||||||
|
if (Test-Path $preservePath) {
|
||||||
|
# Ensure staging folder exists
|
||||||
|
$stagingPath = Join-Path $scriptDir "Update_Staging"
|
||||||
|
if (-not (Test-Path $stagingPath)) {
|
||||||
|
New-Item -ItemType Directory -Force -Path $stagingPath | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Move-Item -Path $preservePath -Destination $preserveBackupPath -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Delete old directories/files
|
|
||||||
Run-Step "Updating: Clean Up Folders to Prepare for Update" {
|
Run-Step "Updating: Clean Up Folders to Prepare for Update" {
|
||||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue `
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue `
|
||||||
(Join-Path $scriptDir "Data"), `
|
(Join-Path $scriptDir "Data"), `
|
||||||
@ -499,14 +512,9 @@ switch ($choice) {
|
|||||||
(Join-Path $scriptDir "Server\web-interface\build"), `
|
(Join-Path $scriptDir "Server\web-interface\build"), `
|
||||||
(Join-Path $scriptDir "Server\web-interface\public"), `
|
(Join-Path $scriptDir "Server\web-interface\public"), `
|
||||||
(Join-Path $scriptDir "Server\Borealis")
|
(Join-Path $scriptDir "Server\Borealis")
|
||||||
|
|
||||||
# Backup Launcher Scripts
|
|
||||||
#Rename-Item -ErrorAction SilentlyContinue (Join-Path $scriptDir "Launch-Borealis.ps1") "Launch-Borealis.ps1.bak"
|
|
||||||
#Rename-Item -ErrorAction SilentlyContinue (Join-Path $scriptDir "Launch-Borealis.sh") "Launch-Borealis.sh.bak"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Run-Step "Updating: Create Update Staging Folder" {
|
Run-Step "Updating: Create Update Staging Folder" {
|
||||||
# Ensure staging folder exists
|
|
||||||
$stagingPath = Join-Path $scriptDir "Update_Staging"
|
$stagingPath = Join-Path $scriptDir "Update_Staging"
|
||||||
if (-not (Test-Path $stagingPath)) {
|
if (-not (Test-Path $stagingPath)) {
|
||||||
New-Item -ItemType Directory -Force -Path $stagingPath | Out-Null
|
New-Item -ItemType Directory -Force -Path $stagingPath | Out-Null
|
||||||
@ -528,6 +536,18 @@ switch ($choice) {
|
|||||||
Copy-Item "$updateDir\*" $scriptDir -Recurse -Force
|
Copy-Item "$updateDir\*" $scriptDir -Recurse -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Run-Step "Updating: Restore Tesseract-OCR Folder" {
|
||||||
|
$restorePath = Join-Path $scriptDir "Data\Server\Python_API_Endpoints"
|
||||||
|
if (Test-Path $preserveBackupPath) {
|
||||||
|
# Ensure destination path exists
|
||||||
|
if (-not (Test-Path $restorePath)) {
|
||||||
|
New-Item -ItemType Directory -Force -Path $restorePath | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Move-Item -Path $preserveBackupPath -Destination $restorePath -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Run-Step "Updating: Clean Up Update Staging Folder" {
|
Run-Step "Updating: Clean Up Update Staging Folder" {
|
||||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue (Join-Path $scriptDir "Update_Staging")
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue (Join-Path $scriptDir "Update_Staging")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user