mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cmd/*-sync: avoid clobbering existing user installations
If a user already has an existing version installed, let's avoid deleting it.
This commit is contained in:
parent
f5cde8ad0d
commit
dde493c6e9
@ -58,6 +58,8 @@ module Homebrew
|
|||||||
(0..minor_version).each do |minor|
|
(0..minor_version).each do |minor|
|
||||||
(0..patch_version).each do |patch|
|
(0..patch_version).each do |patch|
|
||||||
link_path = nodenv_versions/"#{major_version}.#{minor}.#{patch}"
|
link_path = nodenv_versions/"#{major_version}.#{minor}.#{patch}"
|
||||||
|
# Don't clobber existing user installations.
|
||||||
|
next if link_path.exist? && !link_path.symlink?
|
||||||
|
|
||||||
FileUtils.rm_f link_path
|
FileUtils.rm_f link_path
|
||||||
FileUtils.ln_sf path, link_path
|
FileUtils.ln_sf path, link_path
|
||||||
|
@ -56,6 +56,8 @@ module Homebrew
|
|||||||
|
|
||||||
(0..patch_version).each do |patch|
|
(0..patch_version).each do |patch|
|
||||||
link_path = pyenv_versions/"#{major_version}.#{minor_version}.#{patch}"
|
link_path = pyenv_versions/"#{major_version}.#{minor_version}.#{patch}"
|
||||||
|
# Don't clobber existing user installations.
|
||||||
|
next if link_path.exist? && !link_path.symlink?
|
||||||
|
|
||||||
FileUtils.rm_f link_path
|
FileUtils.rm_f link_path
|
||||||
FileUtils.ln_sf path, link_path
|
FileUtils.ln_sf path, link_path
|
||||||
|
@ -57,6 +57,8 @@ module Homebrew
|
|||||||
|
|
||||||
(0..patch_version).each do |patch|
|
(0..patch_version).each do |patch|
|
||||||
link_path = rbenv_versions/"#{major_version}.#{minor_version}.#{patch}"
|
link_path = rbenv_versions/"#{major_version}.#{minor_version}.#{patch}"
|
||||||
|
# Don't clobber existing user installations.
|
||||||
|
next if link_path.exist? && !link_path.symlink?
|
||||||
|
|
||||||
FileUtils.rm_f link_path
|
FileUtils.rm_f link_path
|
||||||
FileUtils.ln_sf path, link_path
|
FileUtils.ln_sf path, link_path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user