#!/bin/bash # Make a list of libraries that the files mentioned in the supplied file link to. source `which ttPM-funcs` 2>/dev/null || exit 1 if [ $# = 0 ] then printMsg warning "Usage: `basename $0` file" exit 1 fi if [ ! -f $1 ] then printMsg warning "Given file does not exist" exit 1 fi TMPFILE1=`mktemp` TMPFILE2=`mktemp` # Create a list of all linked libraries for F in `cat ${1}` do #ldd ${F} 2>/dev/null | grep = >> $TMPFILE 2>/dev/null readelf -d $F 2>/dev/null | grep NEEDED >> $TMPFILE1 done #cat $TMPFILE | grep -v "not found" | grep -v "linux-gate.so.1" | cut -f 3 -d " " | sort | uniq cat $TMPFILE1 | cut -d "[" -f 2,2 | sed -e "s@]@@g" | sort | uniq > $TMPFILE2 for i in $(cat $TMPFILE2) do if [ -f /lib/$i ] then echo /lib/$i elif [ -f /usr/lib/$i ] then echo /usr/lib/$i else echo $i fi done # Clean the tmp file rm -f $TMPFILE1 $TMPFILE2