only generate requirements for executable files
[platform/upstream/rpm.git] / autodeps / linux.req
1 #!/bin/sh
2
3 # note this works for both a.out and ELF executables
4 # it also auto-generates requirment lines for shell scripts
5
6 ulimit -c 0
7
8 filelist=`sed "s/['\"]/\\\&/g"`
9 exelist=`echo $filelist | xargs -r file | fgrep executable | cut -d: -f1 `
10 scriptlist=`echo $filelist | xargs -r file | egrep ":.*(perl |script )" | cut -d: -f1 `
11
12 for f in $exelist; do
13     if [ -x $f ]; then
14         ldd $f | awk '/=>/ { print $1 }'
15     fi
16 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | sort -u
17
18 for f in $scriptlist; do
19     if [ -x $f ]; then
20         head -1 $f | sed -e 's/^\#\![   ]*//' | cut -d" " -f1
21     fi
22 done | sort -u