Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cleaning world - umerge.sh
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Zucca
Apprentice
Apprentice


Joined: 14 Jun 2007
Posts: 201
Location: Helsinki, Finland

PostPosted: Mon Jan 05, 2009 2:27 pm    Post subject: Cleaning world - umerge.sh Reply with quote

Many times when I search for a certain kind of program I usually emerge many candidates. Finally when I have decided what program to use I forget to unmerge all the other programs that I installed for testing. I want to keep my system clean - only keeping the apps I really need. This is why I did a simple bash script that reads trough the world file and then gives you a list of packages to get rid of. It always uses --ask for emerge, so you can safely test it first.

Here's the source:
Code:
#!/bin/bash
# umerge.sh - unmerge packages easily
# v0.0.2b

UMERGELIST=`mktemp -t "unmerge_list_XXXXX"`

dialog --title 'Dialog unmerger' --single-quoted --checklist 'Select packages to unmerge' 0 0 0 `while read LINE; do echo -n "$LINE | off "; done < /var/lib/portage/world | sort` 2> "$UMERGELIST"
clear

sed -i "s/'//g" $UMERGELIST

emerge -vaC `cat $UMERGELIST`

rm $UMERGELIST


After you have unmerged packages, you can run 'emerge -va --depclean' to remove all the useless depencies that were needed by the packages you just unmerged.

At least this works on my PC. ;)
_________________
Threading support for your bash scripts.


Last edited by Zucca on Sat May 16, 2009 10:36 am; edited 3 times in total
Back to top
View user's profile Send private message
spindle
Apprentice
Apprentice


Joined: 01 Dec 2003
Posts: 239

PostPosted: Mon Jan 05, 2009 3:57 pm    Post subject: Reply with quote

This should be handy, I usually do this by hand. Thanks Zucca.
Back to top
View user's profile Send private message
Zucca
Apprentice
Apprentice


Joined: 14 Jun 2007
Posts: 201
Location: Helsinki, Finland

PostPosted: Mon Jan 05, 2009 4:29 pm    Post subject: Reply with quote

This can be useful also:
Code:
/path/to/unmerge.sh && emerge -va --depclean && revdep-rebuild -- -va
;)
Basically: remove packages of your choice --> remove the deps of those packages (if no other package uses them) --> check deps after --depclean
_________________
Threading support for your bash scripts.
Back to top
View user's profile Send private message
Zucca
Apprentice
Apprentice


Joined: 14 Jun 2007
Posts: 201
Location: Helsinki, Finland

PostPosted: Tue Jan 06, 2009 10:02 pm    Post subject: Reply with quote

I also made merge.sh for installing packages. ;)
_________________
Threading support for your bash scripts.
Back to top
View user's profile Send private message
imake
n00b
n00b


Joined: 08 Jan 2009
Posts: 7

PostPosted: Tue Jan 13, 2009 5:21 pm    Post subject: Re: Cleaning world - umerge.sh Reply with quote

It's very useful,thanks a lot~
Back to top
View user's profile Send private message
Zucca
Apprentice
Apprentice


Joined: 14 Jun 2007
Posts: 201
Location: Helsinki, Finland

PostPosted: Tue Jan 13, 2009 6:11 pm    Post subject: Reply with quote

Nice to see people finding this useful. :)
_________________
Threading support for your bash scripts.
Back to top
View user's profile Send private message
Zucca
Apprentice
Apprentice


Joined: 14 Jun 2007
Posts: 201
Location: Helsinki, Finland

PostPosted: Sat May 16, 2009 10:37 am    Post subject: Reply with quote

UPDATE: Just made it working with the new emerge command.
_________________
Threading support for your bash scripts.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum