cmd/uninstall: note etc files that stay around.

We don't remove `etc` files on uninstall. Now we have `pkgetc`, though,
we have a pretty decent guess at what files in `etc` may belong to a
given package and can warn about them being left around on uninstall.

Thoughts: should we do the same thing for `var`? I don't see it being
used nearly as consistently.
This commit is contained in:
Mike McQuaid 2020-05-08 10:37:51 +01:00
parent a635db0f26
commit 04ae589d5c
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -80,6 +80,27 @@ module Homebrew
puts "#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed." puts "#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed."
puts "Run `brew uninstall --force #{keg.name}` to remove all versions." puts "Run `brew uninstall --force #{keg.name}` to remove all versions."
end end
paths = f.pkgetc.find.map(&:to_s) if f.pkgetc.exist?
if paths.present?
puts
opoo <<~EOS
The following #{f.name} configuration files have not been removed!
If desired, remove them manually with `rm -rf`:
#{paths.sort.uniq.join("\n ")}
EOS
end
unversioned_name = f.name.gsub(/@.+$/, "")
maybe_paths = Dir.glob("#{f.etc}/*#{unversioned_name}*") - paths
if maybe_paths.present?
puts
opoo <<~EOS
The following may be #{f.name} configuration files and have not been removed!
If desired, remove them manually with `rm -rf`:
#{maybe_paths.sort.uniq.join("\n ")}
EOS
end
end end
end end
end end