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(update): Do not uninstall the entire app when updating, add pre_update #5678

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [v0.3.2](https://github.com/ScoopInstaller/Scoop/compare/v0.3.1...v0.3.2) - 2023-09-18

### Features

- **update:** To prevent user data loss, do not uninstall the entire app when updating, i.e. don't trigger `pre_uninstall`, `post_uninstall` and `uninstaller`
- **update:** Add support for `pre_update` (instead of `post_uninstall` in the update process)

## [v0.3.1](https://github.com/ScoopInstaller/Scoop/compare/v0.3.0...v0.3.1) - 2022-11-15

### Features
Expand Down
6 changes: 1 addition & 5 deletions libexec/scoop-update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,12 @@ 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
}
#endregion Workaround for #2952

Write-Host "Uninstalling '$app' ($old_version)"
run_uninstaller $old_manifest $architecture $dir
rm_shims $app $old_manifest $global $architecture
env_rm_path $old_manifest $dir $global $architecture
env_rm $old_manifest $global $architecture
Expand All @@ -291,7 +287,7 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
}
}

Invoke-HookScript -HookType 'post_uninstall' -Manifest $old_manifest -Arch $architecture
Invoke-HookScript -HookType 'pre_update' -Manifest $old_manifest -Arch $architecture

if ($bucket) {
# add bucket name it was installed from
Expand Down
6 changes: 6 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@
"pre_install": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"pre_update": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"pre_uninstall": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
Expand Down Expand Up @@ -619,6 +622,9 @@
"pre_install": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"pre_update": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"pre_uninstall": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
Expand Down