summaryrefslogtreecommitdiff
path: root/autodeps/openbsd.req
blob: 551ac2cfb8b11c062f71250e5767b7b8ed046eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# ----------------------------------------------------------------
#	find-requires for OpenBSD-2.2.x
#	how do we know what is required by a.out shared libraries?
# ----------------------------------------------------------------
ulimit -c 0

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

for f in $exelist; do
    if [ -x $f ]; then
        ldd $f | /usr/bin/awk '/\=\>/&&!/not found/ { print $3 }'
    fi
done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u

for f in $scriptlist; do
    if [ -x $f ]; then
        head -1 $f | sed -e 's/^\#\![   ]*//' | cut -d" " -f1
    fi
done | sort -u