allow upgrades, restore state on reinstall
CI / Build & Test (push) Successful in 2m53s

This commit is contained in:
Raven Scott
2026-02-28 17:43:26 -05:00
parent 5ee11896d7
commit 98f75f01b3
3 changed files with 92 additions and 14 deletions
+37 -1
View File
@@ -19,7 +19,29 @@ Write-Host "==========================" -ForegroundColor Cyan
Write-Host "Install : $InstallDir"
Write-Host ""
# ── Uninstall any previous install ────────────────────────────────────────────
# ── Preserve user data from any previous installation ─────────────────────────
$StashDir = Join-Path $env:TEMP "holesail-browser-stash-$([System.Guid]::NewGuid().ToString('N'))"
$StashStorage = Join-Path $StashDir "holesail-browser-storage"
$StashCerts = Join-Path $StashDir "holesail-browser-certs"
$HadPrevious = $false
if (Test-Path $InstallDir) {
Write-Host "Preserving existing settings and certificates..."
New-Item -ItemType Directory -Path $StashDir -Force | Out-Null
$StorageSrc = Join-Path $InstallDir "holesail-browser-storage"
$CertsSrc = Join-Path $InstallDir "holesail-browser-certs"
if (Test-Path $StorageSrc) {
Copy-Item $StorageSrc $StashStorage -Recurse -Force
Write-Host " Saved: holesail-browser-storage"
}
if (Test-Path $CertsSrc) {
Copy-Item $CertsSrc $StashCerts -Recurse -Force
Write-Host " Saved: holesail-browser-certs"
}
$HadPrevious = $true
}
# ── Stop any running instance ──────────────────────────────────────────────────
Write-Host "Removing any previous installation..."
Get-Process | Where-Object { $_.Path -like "*holesail-browser-host*" } | Stop-Process -Force -ErrorAction SilentlyContinue
if (Test-Path $InstallDir) { Remove-Item $InstallDir -Recurse -Force }
@@ -51,6 +73,20 @@ if (-not $HostBin) {
}
Write-Host " Binary: $HostBin"
# ── Restore preserved user data ────────────────────────────────────────────────
if ($HadPrevious) {
Write-Host "Restoring settings and certificates..."
if (Test-Path $StashStorage) {
Copy-Item $StashStorage (Join-Path $InstallDir "holesail-browser-storage") -Recurse -Force
Write-Host " Restored: holesail-browser-storage"
}
if (Test-Path $StashCerts) {
Copy-Item $StashCerts (Join-Path $InstallDir "holesail-browser-certs") -Recurse -Force
Write-Host " Restored: holesail-browser-certs"
}
Remove-Item $StashDir -Recurse -Force -ErrorAction SilentlyContinue
}
Write-Host "Downloading extension..."
Invoke-WebRequest "$ReleaseBase/$ExtZip" -OutFile "$Downloads\$ExtZip"
Write-Host " Saved: $Downloads\$ExtZip"
+30 -1
View File
@@ -34,7 +34,24 @@ echo "Platform : ${PLATFORM}-${ARCH}"
echo "Install : ${INSTALL_DIR}"
echo ""
# ── Uninstall any previous local/source install ────────────────────────────────
# ── Preserve user data from any previous installation ─────────────────────────
STASH_DIR="$(mktemp -d)"
STASH_STORAGE="${STASH_DIR}/holesail-browser-storage"
STASH_CERTS="${STASH_DIR}/holesail-browser-certs"
HAD_PREVIOUS=false
if [[ -d "$INSTALL_DIR" ]]; then
echo "Preserving existing settings and certificates..."
[[ -d "${INSTALL_DIR}/holesail-browser-storage" ]] && \
cp -a "${INSTALL_DIR}/holesail-browser-storage" "$STASH_STORAGE" && \
echo " Saved: holesail-browser-storage"
[[ -d "${INSTALL_DIR}/holesail-browser-certs" ]] && \
cp -a "${INSTALL_DIR}/holesail-browser-certs" "$STASH_CERTS" && \
echo " Saved: holesail-browser-certs"
HAD_PREVIOUS=true
fi
# ── Stop any running instance ──────────────────────────────────────────────────
echo "Removing any previous installation..."
pkill -f "holesail-browser/native-host/index.mjs" 2>/dev/null || true
pkill -f "holesail-browser-host" 2>/dev/null || true
@@ -67,6 +84,18 @@ if [[ -z "$HOST_BIN" ]]; then
fi
chmod +x "$HOST_BIN"
# ── Restore preserved user data ────────────────────────────────────────────────
if [[ "$HAD_PREVIOUS" == "true" ]]; then
echo "Restoring settings and certificates..."
[[ -d "$STASH_STORAGE" ]] && \
cp -a "$STASH_STORAGE" "${INSTALL_DIR}/holesail-browser-storage" && \
echo " Restored: holesail-browser-storage"
[[ -d "$STASH_CERTS" ]] && \
cp -a "$STASH_CERTS" "${INSTALL_DIR}/holesail-browser-certs" && \
echo " Restored: holesail-browser-certs"
fi
rm -rf "$STASH_DIR"
# On macOS: remove quarantine and ad-hoc sign so Gatekeeper doesn't block
# the binary or the .bare native addons it extracts to $TMPDIR at runtime.
if [[ "$PLATFORM" == "darwin" ]]; then