summaryrefslogtreecommitdiff
path: root/scripts/find-requires.perl
blob: a4571007a2dcc0fa1df5133df8c66046b559e037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

# note this works for both a.out and ELF executables
# it also auto-generates requirment lines for shell scripts

ulimit -c 0

filelist=`sed "s/['\"]/\\\&/g"`
scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 `

perllist=
for f in $scriptlist; do
    [ -x $f ] || continue
    interp=`head -1 $f | sed -e 's/^\#\![ 	]*//' | cut -d" " -f1 `
    case $interp in
    */perl) perllist="$perllist $f" ;;
    esac
done | sort -u

#
# Generate perl module dependencies, if any.
set -x
[ -x /usr/lib/rpm/perl.req -a -n "$perllist" ] && \
	echo $perllist | tr [:blank:] \\n | /usr/lib/rpm/perl.req | sort -u
set +x
echo $filelist | /usr/lib/rpm/find-requires