postmodern / chruby

Changes the current Ruby
MIT License
2.85k stars 190 forks source link

[Uninstall] Only remove chruby folder #400

Closed JuanitoFatas closed 3 years ago

JuanitoFatas commented 6 years ago

Right now my /usr/local/share folder contains other files, so when I ran sudo make uninstall it errors:

$ sudo make uninstall
for file in `find etc lib bin sbin share -type f 2>/dev/null`; do rm -f /usr/local/$file; done
rm -rf /usr/local/share/doc/chruby-0.3.9
rmdir /usr/local/share/chruby
rmdir: /usr/local/share/chruby: Not a directory
make: *** [uninstall] Error 1

This Pull Request only removes /usr/local/share/chruby folder.

postmodern commented 6 years ago

Wait, which file is left remaining in the share/chruby directory that's preventing rmdir from succeeding?

JuanitoFatas commented 6 years ago
ls /usr/local/share/chruby
auto.sh   chruby.sh

$ chruby git:(master) sudo make uninstall
Password:
for file in `find etc lib bin sbin share -type f 2>/dev/null`; do rm -f /usr/local/$file; done
rm -rf /usr/local/share/doc/chruby-0.3.9
rmdir /usr/local/share
rmdir: /usr/local/share: Directory not empty
make: *** [uninstall] Error 1

$ chruby git:(master) ls -al /usr/local/share/chruby
lrwxr-xr-x  1 juanitofatas  admin  35 Jun 12 13:17 /usr/local/share/chruby -> ../Cellar/chruby/0.3.9/share/chruby
postmodern commented 6 years ago

Ah ha, I see the typo now! I believe the correct thing to do is rmdir $(DESTDIR)$(SHARE_DIR)/chruby. The for-loop above that command should empty the share/chruby directory. However, I was trying to rmdir the whole share directory... If you could amend your PR to use a safer rmdir, I'll merge it.

JuanitoFatas commented 5 years ago

@postmodern PR updated to use rmdir.

postmodern commented 3 years ago

Manually merged into master and fixed the git conflict. Thanks!