pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: upgrading pkgsrc, and variations on the theme of bin-install



On Fri 17 Oct 2008 at 23:41:19 -0400, Taylor R Campbell wrote:
> Since binary packages are hard, I think that next time I sha'n't
> bother with reusing old ones at all, and instead upgrade entirely from
> source.  Now, to clean out my directory of binary packages without
> checking versions on three hundred packages by hand...

Maybe you meant that you have a directory with older and newer binary
versions of the same package mixed together. I have a a script for that
too.

#!/bin/sh
#
# move_older_versions_to_attic
#
# Usage: $0 fromdir todir
#
# Moves olver versions of packages to an "Attic" directory.
# Fromdir should be an absolute path.

fromdir=$1
todir=$2
# fromdir should be an absolute path now, since pkg_admin lsbest prints
# absolute pathnames...

if [ ! -w $todir ]
then
    echo "Can't write in $todir"
    exit
fi

for f in $(ls $fromdir)
do
    # strip version number and .tgz
    pkg=$(echo $f | sed -e 's/-[0-9][^-]*\.tgz$//')
    # If pattern did not match, leave the file alone
    if [ "$pkg" != "$f" ]
    then
        best=$(pkg_admin lsbest $fromdir/$pkg'-[0-9]*')
        if [ "$fromdir/$f" = "$best" ]
        then
            echo $f is still the best
        else
            echo $f moved to Attic, $best is best...
            mv "$fromdir/$f" "$todir"
        fi
    else
        echo "FILE $f HAS UNRECOGNISED STRUCTURE; check manually."
    fi
done

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.


Home | Main Index | Thread Index | Old Index