comparison misc/debian-dependencies.sh @ 378:84fd4bb8d656

* Add misc/ directory from SVN repo
author Chris Cannam
date Mon, 18 Oct 2010 13:44:25 +0100
parents
children f84413dd5a7a
comparison
equal deleted inserted replaced
361:101f05420cba 378:84fd4bb8d656
1 #!/bin/bash
2
3 target=$1
4
5 if [ ! -f "$target" ]; then
6 echo "Usage: $0 target-executable"
7 exit 1
8 fi
9
10 pfile=/tmp/packages_$$
11 rfile=/tmp/redundant_$$
12
13 trap "rm -f $pfile $rfile" 0
14 echo
15
16 ldd "$target" | awk '{ print $3; }' | while read lib; do
17 if test -n "$lib" ; then
18 dpkg-query -S "$lib"
19 fi
20 done | grep ': ' | awk -F: '{ print $1 }' | sort | uniq > $pfile
21
22 echo "Packages providing required libraries:"
23 cat $pfile
24 echo
25
26 for p in `cat $pfile`; do
27 apt-cache showpkg "$p" | grep '^ ' | grep ',' | awk -F, '{ print $1; }' | \
28 while read d; do
29 if grep -q '^'$d'$' $pfile; then
30 echo $p
31 fi
32 done
33 done | sort | uniq > $rfile
34
35 echo "Packages that can be eliminated because other packages depend on them:"
36 cat $rfile
37 echo
38
39 echo "Remaining required packages:"
40 cat $pfile $rfile | sort | uniq -u
41