Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Binary Package cleanup script
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
jeb-c4
n00b
n00b


Joined: 27 Jul 2002
Posts: 35

PostPosted: Thu Sep 18, 2003 10:42 pm    Post subject: Binary Package cleanup script Reply with quote

Just thought I would share this script to clean up my /usr/portage/packages.

It does a cp -l (hard link), so it wastes no space copying and is VERY fast. It will also build a package if you don't have one (one to comment out if you don't like that).

It does NOT preserve the symlinked dir and packages -- you will only be left with /usr/portage/packages/All (I prefer this, but someone could extend this if they like).

Oh yeah, you have qpkg (emerge qpkg).

Email me @ jebc at c4solutions.net.

Code:
#!/bin/bash
PKGDIR=/usr/portage/packages

VERSIONS=`qpkg -I -v -nc | sort`

mkdir -p $PKGDIR/.All

for version in $VERSIONS; do
        PACKAGE=`basename $version`

        if [ -f $PKGDIR/All/$PACKAGE.tbz2 ]; then
                cp -l $PKGDIR/All/$PACKAGE.tbz2 $PKGDIR/.All/
        else
                echo "$version has no package"
                emerge -B =$version
                cp -l $PKGDIR/All/$PACKAGE.tbz2 $PKGDIR/.All/
        fi
done

rm -rf $PKGDIR/*
mv $PKGDIR/.All $PKGDIR/All
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