rbuninstall.rb: show paths without destdir as well as rbinstall.rb

This commit is contained in:
Nobuyoshi Nakada 2020-05-09 13:45:50 +09:00
parent e88bb6a2f7
commit 1181edd54c
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
1 changed files with 5 additions and 4 deletions

View File

@ -23,7 +23,6 @@ BEGIN {
$files = []
}
list = ($_.chomp!('/') ? $dirs : $files)
$_ = File.join($destdir, $_) if $destdir
list << $_
END {
status = true
@ -32,6 +31,7 @@ END {
$files.each do |file|
print "rm #{file}#{ors}"
unless $dryrun
file = File.join($destdir, file) if $destdir
begin
File.unlink(file)
rescue Errno::ENOENT
@ -49,13 +49,14 @@ END {
dir = File.dirname(dir) while File.basename(dir) == '.'
print "rmdir #{dir}#{ors}"
unless $dryrun
realdir = $destdir ? File.join($destdir, dir) : dir
begin
begin
unlink.delete(dir)
Dir.rmdir(dir)
Dir.rmdir(realdir)
rescue Errno::ENOTDIR
raise unless File.symlink?(dir)
File.unlink(dir)
raise unless File.symlink?(realdir)
File.unlink(realdir)
end
rescue Errno::ENOENT, Errno::ENOTEMPTY
rescue