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
+25 -12
View File
@@ -23,21 +23,34 @@ Or download `install.ps1` from the [latest release](https://git.ssh.surf/snxrave
### macOS / Linux (`install.sh`) ### macOS / Linux (`install.sh`)
1. Detects your OS and architecture (`darwin`/`linux`, `x64`/`arm64`) 1. Detects your OS and architecture (`darwin`/`linux`, `x64`/`arm64`)
2. Kills any running `holesail-browser-host` process 2. **Preserves existing user data** — if a previous installation is found, `holesail-browser-storage/` (state, settings, backups) and `holesail-browser-certs/` (CA key and certificates) are copied to a temporary location before anything is removed
3. Removes any previous installation (`~/.holesail-browser/`) and old native messaging manifests 3. Kills any running `holesail-browser-host` process
4. Downloads `holesail-browser-host-<platform>-<arch>.zip` from the latest release 4. Removes the previous installation directory and old native messaging manifests
5. Extracts the binary to `~/.holesail-browser/holesail-browser-host` 5. Downloads `holesail-browser-host-<platform>-<arch>.zip` from the latest release
6. **macOS only:** removes Gatekeeper quarantine, ad-hoc signs the binary, pre-runs it to extract `.bare` native addons, then signs all extracted addons 6. Extracts the binary to `~/.holesail-browser/holesail-browser-host`
7. Downloads `Holesail-Browser-1.0.0.zip` and `Holesail-Browser-1.0.0.xpi` to `~/Downloads` 7. **Restores user data** — the preserved storage and certs directories are copied back, so all tunnels, connections, settings, and certificates survive the upgrade
8. Writes the native messaging manifest to all browser locations 8. **macOS only:** removes Gatekeeper quarantine, ad-hoc signs the binary, pre-runs it to extract `.bare` native addons, then signs all extracted addons
9. Downloads `Holesail-Browser-1.0.0.zip` and `Holesail-Browser-1.0.0.xpi` to `~/Downloads`
10. Writes the native messaging manifest to all browser locations
### Windows (`install.ps1`) ### Windows (`install.ps1`)
1. Kills any running `holesail-browser-host.exe` process 1. **Preserves existing user data** — if a previous installation is found, `holesail-browser-storage\` and `holesail-browser-certs\` are copied to a temporary location in `%TEMP%`
2. Removes any previous installation (`%LOCALAPPDATA%\holesail-browser\`) and old registry keys 2. Kills any running `holesail-browser-host.exe` process
3. Downloads `holesail-browser-host-win32-x64.zip` and extracts the `.exe` 3. Removes the previous installation directory and old registry keys
4. Downloads `Holesail-Browser-1.0.0.zip` to `~/Downloads` 4. Downloads `holesail-browser-host-win32-x64.zip` and extracts the `.exe`
5. Writes the native messaging manifest JSON and creates registry keys for Chrome, Chromium, and Firefox 5. **Restores user data** — the preserved directories are copied back into the new installation
6. Downloads `Holesail-Browser-1.0.0.zip` to `~/Downloads`
7. Writes the native messaging manifest JSON and creates registry keys for Chrome, Chromium, and Firefox
### What is preserved across upgrades
| Directory | Contents |
|-----------|----------|
| `holesail-browser-storage/` | `state.json` (all virtual hosts, tunnels, SSH/RDP connections, settings), backup archives |
| `holesail-browser-certs/` | Root CA key and certificate, wildcard `*.hole.sail` domain cert |
The binary itself is always replaced with the new version. If this is a fresh install (no previous `~/.holesail-browser/` directory), the preserve/restore steps are skipped.
--- ---
+37 -1
View File
@@ -19,7 +19,29 @@ Write-Host "==========================" -ForegroundColor Cyan
Write-Host "Install : $InstallDir" Write-Host "Install : $InstallDir"
Write-Host "" 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..." Write-Host "Removing any previous installation..."
Get-Process | Where-Object { $_.Path -like "*holesail-browser-host*" } | Stop-Process -Force -ErrorAction SilentlyContinue Get-Process | Where-Object { $_.Path -like "*holesail-browser-host*" } | Stop-Process -Force -ErrorAction SilentlyContinue
if (Test-Path $InstallDir) { Remove-Item $InstallDir -Recurse -Force } if (Test-Path $InstallDir) { Remove-Item $InstallDir -Recurse -Force }
@@ -51,6 +73,20 @@ if (-not $HostBin) {
} }
Write-Host " Binary: $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..." Write-Host "Downloading extension..."
Invoke-WebRequest "$ReleaseBase/$ExtZip" -OutFile "$Downloads\$ExtZip" Invoke-WebRequest "$ReleaseBase/$ExtZip" -OutFile "$Downloads\$ExtZip"
Write-Host " Saved: $Downloads\$ExtZip" Write-Host " Saved: $Downloads\$ExtZip"
+30 -1
View File
@@ -34,7 +34,24 @@ echo "Platform : ${PLATFORM}-${ARCH}"
echo "Install : ${INSTALL_DIR}" echo "Install : ${INSTALL_DIR}"
echo "" 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..." echo "Removing any previous installation..."
pkill -f "holesail-browser/native-host/index.mjs" 2>/dev/null || true pkill -f "holesail-browser/native-host/index.mjs" 2>/dev/null || true
pkill -f "holesail-browser-host" 2>/dev/null || true pkill -f "holesail-browser-host" 2>/dev/null || true
@@ -67,6 +84,18 @@ if [[ -z "$HOST_BIN" ]]; then
fi fi
chmod +x "$HOST_BIN" 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 # 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. # the binary or the .bare native addons it extracts to $TMPDIR at runtime.
if [[ "$PLATFORM" == "darwin" ]]; then if [[ "$PLATFORM" == "darwin" ]]; then