Subject: Re: Removing old libraries after an upgrade
To: Patrick Welche <prlw1@newn.cam.ac.uk>
From: Jared D. McNeill <jmcneill@invisible.yi.org>
List: current-users
Date: 03/05/2001 13:38:30
I just came up with a script to get a list of all old libraries -- anybody
care to comment on it? It seems to work for me..
Thanks,
Jared
#!/bin/sh
# Get old system libraries and biff them to stdout
# Copyright (C) 2001 Jared D. McNeill <jmcneill@invisible.yi.org>
DIRS=/usr/lib
for dir in $DIRS; do
cd $dir
alllibs=`ls *.so.*.* | cut -d . -f 1 | uniq`
for chklib in $alllibs; do
availlibs=`ls $chklib.so.*.*`
# ugh; get latest library
major=0
minor=0
for x in $availlibs; do
majortmp=`echo $x | cut -d . -f 3`
if [ "$majortmp" -gt "$major" ]; then
major=$majortmp
fi
done
availlibs=`ls $chklib.so.$major.*`
for x in $availlibs; do
minortmp=`echo $x | cut -d . -f 4`
if [ "$minortmp" -gt "$minor" ]; then
minor=$minortmp
fi
done
keepme="$chklib.so.$major.$minor"
# Spew everything not needed to stdout
availlibs=`ls $chklib.so.*.*`
for x in $availlibs; do
if [ ! "$x" = "$keepme" ]; then
echo $x
fi
done
done
done