Added %triggerpostun
[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 liblist=`echo $filelist | xargs -r file | grep "shared object" | cut -d : -f1 `
12
13 for f in $exelist; do
14     if [ -x $f ]; then
15         ldd $f | awk '/=>/ { print $1 }'
16     fi
17 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | sort -u
18
19 for f in $liblist; do
20     ldd $f | awk '/=>/ { print $1 }'
21 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | sort -u
22
23 for f in $scriptlist; do
24     if [ -x $f ]; then
25         head -1 $f | sed -e 's/^\#\![   ]*//' | cut -d" " -f1
26     fi
27 done | sort -u