WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tcz-uninstall.tce - does it have the -f option  (Read 13845 times)

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: tcz-uninstall.tce - does it have the -f option
« Reply #30 on: May 24, 2009, 06:51:15 PM »
Adding findutils as a dependency and a one liner like this would get rid of the empty directories ( I am on windows now but here is off the top of my head):

find /tmp/tcloop/"$APP" -type d -empty -print0 | \
sed "s:\/tmp\/tcloop\/"$APP"::"| xargs -0 rm -r

Especially with the window manager changes this script needed some attention, hopefully the next update will be pretty much polish it off.  Thanks for the ideas and feedback.


Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10982
Re: tcz-uninstall.tce - does it have the -f option
« Reply #31 on: May 25, 2009, 05:01:06 AM »
Without requiring findutils, one could just:
Quote
find /tmp/tcloop/"$APP" -type d | sed "s@\/tmp\/tcloop\/${APP}@@" | xargs rmdir
I haven't tested this code, but rmdir doesn't remove a directory if there's even a single file.
The only barriers that can stop you are the ones you create yourself.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: tcz-uninstall.tce - does it have the -f option
« Reply #32 on: May 25, 2009, 06:19:50 AM »
Thanks curaga, I added that and it saved a few lines of test cases and such and the need for findutils.

Sudo was missing in a couple of places, hence files left behind.  Hopefully fixed the remaining bugs, uploaded the result.  Hopefully all that is left now is supporting the different window managers.

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: tcz-uninstall.tce - does it have the -f option
« Reply #33 on: May 25, 2009, 08:23:13 AM »
Without requiring findutils, one could just:
Quote
find /tmp/tcloop/"$APP" -type d | sed "s@\/tmp\/tcloop\/${APP}@@" | xargs rmdir
I haven't tested this code, but rmdir doesn't remove a directory if there's even a single file.

Doesn't this yield "/"    ?    (I don't understand the sed 's@/dir/dir@@'   part  ) 

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10982
Re: tcz-uninstall.tce - does it have the -f option
« Reply #34 on: May 25, 2009, 08:53:17 AM »
/ has files in it, thus it doesn't get removed
The only barriers that can stop you are the ones you create yourself.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: tcz-uninstall.tce - does it have the -f option
« Reply #35 on: May 25, 2009, 09:08:17 AM »
Without requiring findutils, one could just:
Quote
find /tmp/tcloop/"$APP" -type d | sed "s@\/tmp\/tcloop\/${APP}@@" | xargs rmdir
I haven't tested this code, but rmdir doesn't remove a directory if there's even a single file.

Can this command be made to work recursively? That is if an empty folder is deleted and the deletion causes the parent folder to be empty and so on can all the empty folders in sequence be deleted?
« Last Edit: May 25, 2009, 09:11:09 AM by bigpcman »
big pc man

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: tcz-uninstall.tce - does it have the -f option
« Reply #36 on: May 25, 2009, 09:20:30 AM »
/ has files in it, thus it doesn't get removed

weird....I typed the exact same command into another terminal, and it worked.  The find was literally
producing "/"   instead of /dir/dir 

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10982
Re: tcz-uninstall.tce - does it have the -f option
« Reply #37 on: May 25, 2009, 09:28:35 AM »
Quote
Can this command be made to work recursively?
Not easily, so rerunning it a couple times is an easy solution for recursion

edit:
Quote
weird .... it worked.
:D
« Last Edit: May 25, 2009, 09:30:57 AM by curaga »
The only barriers that can stop you are the ones you create yourself.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: tcz-uninstall.tce - does it have the -f option
« Reply #38 on: May 25, 2009, 09:47:28 AM »
Quote
Can this command be made to work recursively?
Not easily, so rerunning it a couple times is an easy solution for recursion

edit:
Quote
weird .... it worked.
:D

You mean it works recursively as is? If so can you explain how?
« Last Edit: May 25, 2009, 09:48:59 AM by bigpcman »
big pc man

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10982
Re: tcz-uninstall.tce - does it have the -f option
« Reply #39 on: May 25, 2009, 10:00:52 AM »
No, it doesn't work recursively, I just had to point out jpeters' well chosen words ;)
The only barriers that can stop you are the ones you create yourself.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: tcz-uninstall.tce - does it have the -f option
« Reply #40 on: May 25, 2009, 10:14:37 AM »
An updated version has been uploaded that removes all the empty dirs.

EDIT:
Note: the directories, if any, that are created by the user.tar.gz remain in the system after a --force uninstall.  That is harmless and a small detail I think we can live with.
« Last Edit: May 25, 2009, 05:54:50 PM by Jason W »