made xargs more resilant to quoting characters in filenames
[platform/upstream/rpm.git] / autodeps / linux.prov
1 #!/bin/bash
2
3 # This script reads filenames from STDIN and outputs any relevant provides
4 # information that needs to be included in the package.
5
6 filelist=$(grep "\\.so" | grep -v "^/lib/ld.so" | xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1)
7
8 for f in $filelist; do
9     soname=$(objdump -p $f | awk '/SONAME/ {print $2}')
10
11     if [ "$soname" != "" ]; then
12         if [ ! -L $f ]; then
13             echo $soname
14         fi
15     else
16         echo ${f##*/}
17     fi
18 done | sort -u