- build-release.ps1: builds Docker image, saves to tar, bundles everything into dist\ ready to copy to a flash drive - installer/install.ps1: checks WSL2, Docker Desktop, loads image (or builds from source as fallback), prompts for photo/data paths, writes docker-compose.override.yml, starts container, creates desktop shortcut - installer/uninstall.ps1: stops container, optionally removes image and data, removes shortcut and app directory - installer/dupfinder-start-stop.ps1: start/stop/restart/open helper copied to target machine during install; desktop shortcut uses -Action open which polls until the app is responsive before launching browser Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
77 lines
3.0 KiB
PowerShell
77 lines
3.0 KiB
PowerShell
#Requires -Version 5.1
|
|
<#
|
|
.SYNOPSIS
|
|
Uninstalls DupFinder from this workstation.
|
|
#>
|
|
|
|
$principal = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()
|
|
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
|
Write-Error "This script must be run as Administrator."
|
|
exit 1
|
|
}
|
|
|
|
$ConfigFile = "C:\ProgramData\DupFinder\dupfinder.conf"
|
|
$AppDir = "C:\ProgramData\DupFinder"
|
|
$ShortcutPath = "$env:PUBLIC\Desktop\DupFinder.lnk"
|
|
|
|
Write-Host ""
|
|
Write-Host " DupFinder Uninstaller" -ForegroundColor Magenta
|
|
Write-Host ""
|
|
|
|
if (-not (Test-Path $ConfigFile)) {
|
|
Write-Warning "DupFinder config not found. It may not be installed, or was already removed."
|
|
exit 0
|
|
}
|
|
|
|
# Read config
|
|
$conf = @{}
|
|
Get-Content $ConfigFile | ForEach-Object {
|
|
if ($_ -match '^(.+?)=(.+)$') { $conf[$Matches[1]] = $Matches[2] }
|
|
}
|
|
$ComposeDir = $conf["COMPOSE_DIR"]
|
|
$DataPath = $conf["DATA_PATH"]
|
|
$ComposeYml = "$ComposeDir\docker-compose.yml"
|
|
$OverrideYml = "$ComposeDir\docker-compose.override.yml"
|
|
|
|
# ── Stop and remove container ─────────────────────────────────────────────────
|
|
Write-Host "Stopping and removing container..."
|
|
docker compose -f $ComposeYml -f $OverrideYml down 2>$null
|
|
Write-Host " Done."
|
|
|
|
# ── Remove Docker image? ──────────────────────────────────────────────────────
|
|
$rmImage = Read-Host "Remove the DupFinder Docker image? Frees ~300-600 MB (Y/n)"
|
|
if ($rmImage -ne 'n' -and $rmImage -ne 'N') {
|
|
docker rmi dupfinder:latest 2>$null
|
|
Write-Host " Image removed."
|
|
}
|
|
|
|
# ── Remove data directory? ────────────────────────────────────────────────────
|
|
Write-Host ""
|
|
Write-Host "Data directory: $DataPath"
|
|
Write-Host "This contains the scan database and all decisions."
|
|
$rmData = Read-Host "Remove data directory? This CANNOT be undone. (y/N)"
|
|
if ($rmData -eq 'y' -or $rmData -eq 'Y') {
|
|
if (Test-Path $DataPath) {
|
|
Remove-Item $DataPath -Recurse -Force
|
|
Write-Host " Data directory removed."
|
|
}
|
|
} else {
|
|
Write-Host " Data directory kept at: $DataPath"
|
|
}
|
|
|
|
# ── Remove shortcut ───────────────────────────────────────────────────────────
|
|
if (Test-Path $ShortcutPath) {
|
|
Remove-Item $ShortcutPath -Force
|
|
Write-Host "Desktop shortcut removed."
|
|
}
|
|
|
|
# ── Remove app directory ──────────────────────────────────────────────────────
|
|
if (Test-Path $AppDir) {
|
|
Remove-Item $AppDir -Recurse -Force
|
|
Write-Host "App directory removed: $AppDir"
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host " DupFinder has been uninstalled." -ForegroundColor Green
|
|
Write-Host ""
|