summaryrefslogtreecommitdiff
path: root/autodeps/linux.prov
blob: d82091bf0379617e87d8e07722e30c97a1def2d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

# This script reads filenames from STDIN and outputs any relevant provides
# information that needs to be included in the package.

filelist=$(grep "\\.so" | grep -v "^/lib/ld.so" | xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1)

for f in $filelist; do
    soname=$(objdump --raw $f --section=.dynstr 2> /dev/null | tr '\0' '\n' | tail -1)

    if [ "$soname" != "" ]; then
        if [ "$soname" != "_end" ]; then
            echo $soname
        else
            echo ${f##*/}
        fi
    fi
done | sort -u