annotate deploy/linux/debian-dependencies.sh @ 283:7ed00474dfbb piper-nopiper

Need these on OSX
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 30 Nov 2016 10:16:11 +0000
parents 120723f7698b
children
rev   line source
Chris@252 1 #!/bin/bash
Chris@252 2
Chris@252 3 target=$1
Chris@252 4
Chris@252 5 if [ ! -f "$target" ]; then
Chris@252 6 echo "Usage: $0 target-executable"
Chris@252 7 exit 1
Chris@252 8 fi
Chris@252 9
Chris@252 10 pfile=/tmp/packages_$$
Chris@252 11 rfile=/tmp/redundant_$$
Chris@252 12
Chris@252 13 trap "rm -f $pfile $rfile" 0
Chris@252 14 echo 1>&2
Chris@252 15
Chris@252 16 ldd "$target" | awk '{ print $3; }' | grep '^/' | while read lib; do
Chris@252 17 if test -n "$lib" ; then
Chris@252 18 dpkg-query -S "$lib"
Chris@252 19 fi
Chris@252 20 done | grep ': ' | awk -F: '{ print $1 }' | sort | uniq > $pfile
Chris@252 21
Chris@252 22 echo "Packages providing required libraries:" 1>&2
Chris@252 23 cat $pfile 1>&2
Chris@252 24 echo 1>&2
Chris@252 25
Chris@252 26 for p in `cat $pfile`; do
Chris@252 27 echo Looking at $p 1>&2
Chris@252 28 apt-cache showpkg "$p" | grep '^ ' | grep ',' | awk -F, '{ print $1; }' | \
Chris@252 29 while read d; do
Chris@252 30 if grep -q '^'$d'$' $pfile; then
Chris@252 31 echo $p
Chris@252 32 fi
Chris@252 33 done
Chris@252 34 done | sort | uniq > $rfile
Chris@252 35
Chris@252 36 echo "Packages that can be eliminated because other packages depend on them:" 1>&2
Chris@252 37 cat $rfile 1>&2
Chris@252 38 echo 1>&2
Chris@252 39
Chris@252 40 cat $pfile $rfile | sort | uniq -u | sed 's/$/,/' | fmt -1000 | sed 's/^/Depends: /' | sed 's/,$/, libc6/' | sed 's/libjack0,/jackd,/'
Chris@252 41
Chris@252 42