comparison deploy/linux/debian-dependencies.sh @ 252:120723f7698b

Bring in proto Linux deploy stuff from SV repo
author Chris Cannam
date Tue, 22 Mar 2016 12:07:54 +0000
parents
children
comparison
equal deleted inserted replaced
251:b49f12c9e869 252:120723f7698b
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 1>&2
15
16 ldd "$target" | awk '{ print $3; }' | grep '^/' | 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:" 1>&2
23 cat $pfile 1>&2
24 echo 1>&2
25
26 for p in `cat $pfile`; do
27 echo Looking at $p 1>&2
28 apt-cache showpkg "$p" | grep '^ ' | grep ',' | awk -F, '{ print $1; }' | \
29 while read d; do
30 if grep -q '^'$d'$' $pfile; then
31 echo $p
32 fi
33 done
34 done | sort | uniq > $rfile
35
36 echo "Packages that can be eliminated because other packages depend on them:" 1>&2
37 cat $rfile 1>&2
38 echo 1>&2
39
40 cat $pfile $rfile | sort | uniq -u | sed 's/$/,/' | fmt -1000 | sed 's/^/Depends: /' | sed 's/,$/, libc6/' | sed 's/libjack0,/jackd,/'
41
42