annotate deploy/linux/debian-dependencies.sh @ 705:b93d662a12df

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