Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: scoop uninstall scoop #5685

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- **scoop-checkup:** Change the message level of helpers from ERROR to WARN ([#5549](https://github.com/ScoopInstaller/Scoop/issues/5614))
- **scoop-(un)hold:** Correct output the messages when manifest not found, (already|not) held ([#5519](https://github.com/ScoopInstaller/Scoop/issues/5519))
- **scoop-update:** Change error message to a better instruction ([#5677](https://github.com/ScoopInstaller/Scoop/issues/5677))
- **scoop-uninstall:** fix `scoop uninstall scoop` ([#5685](https://github.com/ScoopInstaller/Scoop/issues/5685))

### Performance Improvements

Expand Down
12 changes: 10 additions & 2 deletions bin/uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@ function do_uninstall($app, $global) {
$architecture = $install.architecture

Write-Output "Uninstalling '$app'"

Invoke-HookScript -HookType 'pre_uninstall' -Manifest $manifest -Arch $architecture

run_uninstaller $manifest $architecture $dir
rm_shims $app $manifest $global $architecture
rm_startmenu_shortcuts $manifest $global $architecture

# If a junction was used during install, that will have been used
# as the reference directory. Othewise it will just be the version
# directory.
$refdir = unlink_current (appdir $app $global)
$refdir = unlink_current $dir

uninstall_psmodule $manifest $refdir $global

env_rm_path $manifest $refdir $global $architecture
env_rm $manifest $global $architecture
Expand All @@ -59,6 +65,8 @@ function do_uninstall($app, $global) {
$errors = $true
warn "Couldn't remove $(friendly_path $appdir): $_.Exception"
}

Invoke-HookScript -HookType 'post_uninstall' -Manifest $manifest -Arch $architecture
}

function rm_dir($dir) {
Expand Down Expand Up @@ -99,6 +107,6 @@ if ($purge) {
}

remove_from_path (shimdir $false)
if ($global) { remove_from_path (shimdir $true) }
if ($global) { remove_from_path (shimdir $true) $true }

success 'Scoop has been uninstalled.'