Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions bucket/everything-alpha.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,46 @@
"Set-Content \"$dir\\install-context.reg\" $reg_content -Encoding ASCII"
],
"pre_uninstall": [
"Stop-Process -Name 'everything' -Force -ErrorAction SilentlyContinue",
"if ($(Get-Service -Name Everything -ErrorAction SilentlyContinue).Status -ne 'Stopped') {",
" if (!(is_admin)) { error 'Admin rights are required to stop Everything service'; break }",
" Stop-Service -Name 'Everything' -Force -ErrorAction SilentlyContinue | Out-Null",
"$appPathPattern = (Split-Path $dir -Parent).Replace('\\', '\\\\')",
"",
"$processes = Get-Process -Name 'everything' -ErrorAction SilentlyContinue",
" | Where-Object { $_.Path -match $appPathPattern }",
"info \"Found $($processes.Length) Everything process(es) to stop\"",
"foreach ($process in $processes) {",
" Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue",
"}",
"if ((Get-Service -Name Everything -ErrorAction SilentlyContinue) -and ($cmd -eq 'uninstall')) {",
" if (!(is_admin)) { error 'Admin rights are required to remove Everything service'; break }",
" sc.exe delete 'Everything'",
"",
"$services = Get-Service -Name Everything* -ErrorAction SilentlyContinue",
" | Where-Object { $_.BinaryPathName -match $appPathPattern }",
"",
"if ($services.Length -gt 1) {",
" error 'Multiple Everything services found, this is likely a bug with this manifest.'",
" break",
"} elseif ($services.Length -eq 0) {",
" info 'No Everything service found, continuing with uninstall.'",
"} else {",
" $service = $services[0]",
" $serviceName = $service.Name",
" info \"Found Everything service: $serviceName\"",
"",
" if (!(is_admin)) {",
" error 'Administrator rights are required to manage Windows services'",
" break",
" }",
"",
" if ($service.Status -ne 'Stopped') {",
" info 'Stopping service'",
" Stop-Service -Name $serviceName -Force | Out-Null",
" }",
"",
" if ($cmd -eq 'uninstall') {",
" info 'Removing service'",
" sc.exe delete $serviceName",
" }",
"}",
"",
"if ($cmd -eq 'uninstall') { reg import \"$dir\\uninstall-context.reg\" }",
"",
"Get-ChildItem \"$dir\\*\" -Include 'Bookmarks*.csv', 'Everything.lng', 'Everything*.db', 'Everything*.ini', 'Filters*.csv', 'Plugins*.ini', 'Run History*.csv', 'Search History*.csv' | Copy-Item -Destination \"$persist_dir\" -ErrorAction SilentlyContinue -Force"
],
"bin": "Everything.exe",
Expand Down