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): Prevent uninstall when update #4949

Merged
merged 6 commits into from
Jun 1, 2022

Conversation

rayinfinite
Copy link
Contributor

Description

When user update scoop for the first time and meet network changes or folder in use. the program would delete whole scoop folder.
And I use Rename-Item instead of Remove-Item to prevent this.
line 77 Test-Path "$newdir\bin\scoop.ps1" is to prevent download using a wrong SCOOP_REPO with no scoop file there.

Motivation and Context

In #3050 there might be some small error caused by bucket but result in remove the whole scoop folder.
So instead of just remove current folder, I rename current folder to old and then delete old folder.

Relates to #4005
Relates to #3050

How Has This Been Tested?

remove .git folder in %scoop%\apps\scoop\current
then run scoop update
and if you open a folder in explorer like %scoop%\apps\scoop\current\libexec
folder in use and go into catch sentence

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

@rayinfinite
Copy link
Contributor Author

The only solution to this problem is when you download scoop using irm get.scoop.sh | iex , download version with .git file.

remove git command print

Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
chawyehsu
chawyehsu previously approved these changes May 29, 2022
Copy link
Member

@niheaven niheaven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just static code review, need test.

CHANGELOG.md Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
@rayinfinite rayinfinite requested a review from niheaven May 29, 2022 17:22
@niheaven
Copy link
Member

It should be okay, I'll test it soon.

@niheaven niheaven merged commit d6c6ddc into ScoopInstaller:develop Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants