Wednesday, December 16, 2009

ldd package finder (APT)

I wrote a bash shell script for getting package names from ldd output.
apt-file, awk, basename, egrep, sort, uniq are needed.
it will list lib64 packages if arg2 = 64. e.g.:
# ./ /bin/bash 64

an example for using in checkinstall:
# checkinstall --requires=` src/mysoft|xargs|sed -e 's/ /,/g'` (...)

for executable with multiple libraries, you can append all libraries' output to one file, sort and uniq that file and you will get the package dependency of those binaries.

one line is a bit long so please ensure you selected all things between Start of File and End Of File.
-Start of File-
if [ "$2" = "64" ];then

ldd $1|awk '{tmp ="basename "$1; tmp|getline bnso;system("apt-file find "bnso);close(tmp)}'|egrep -v $EGR|awk -F':' '{print $1}'|sort|uniq
-End Of File-

No comments:

Post a Comment