From 7bfef4912c3d64e6642786b31d919937e7dc1478 Mon Sep 17 00:00:00 2001 From: yi_Xu Date: Sat, 6 Aug 2022 20:59:39 +0800 Subject: [PATCH] feat(scoop-update): Add support for `pre_uninstall` and `post_uninstall` (#5085) --- CHANGELOG.md | 1 + libexec/scoop-update.ps1 | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce471397ca..a71be71047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - **core:** Improve argument concatenation in `Invoke-ExternalCommand` ([#5065](https://github.com/ScoopInstaller/Scoop/issues/5065)) - **install:** Show bucket name while installing an app ([#5075](https://github.com/ScoopInstaller/Scoop/issues/5075)) - **scoop-status:** Add flag to disable remote checking ([#5073](https://github.com/ScoopInstaller/Scoop/issues/5073)) +- **scoop-update:** Add support for `pre_uninstall` and `post_uninstall` ([#5085](https://github.com/ScoopInstaller/Scoop/issues/5085)) ### Bug Fixes diff --git a/libexec/scoop-update.ps1 b/libexec/scoop-update.ps1 index 845ff635c1..ca502dd7ce 100644 --- a/libexec/scoop-update.ps1 +++ b/libexec/scoop-update.ps1 @@ -243,6 +243,8 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c $dir = versiondir $app $old_version $global $persist_dir = persistdir $app $global + Invoke-HookScript -HookType 'pre_uninstall' -Manifest $old_manifest -Arch $architecture + #region Workaround for #2952 if (test_running_process $app $global) { return @@ -272,6 +274,8 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c } } + Invoke-HookScript -HookType 'post_uninstall' -Manifest $old_manifest -Arch $architecture + if ($bucket) { # add bucket name it was installed from $app = "$bucket/$app"