Mercurial > hg > easyhg
annotate deploy/linux/debian-dependencies.sh @ 717:2a27275b8540
Avoid dropping out when yum tries to ask us a question
author | Chris Cannam |
---|---|
date | Wed, 12 Dec 2018 14:32:31 +0000 |
parents | 665da28f1da8 |
children | 1d0a0fce4021 |
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@713 | 42 echo "Remaining packages:" 1>&2 |
Chris@713 | 43 cat $pfile $rfile | sort | uniq -u 1>&2 |
Chris@713 | 44 echo 1>&2 |
Chris@713 | 45 |
Chris@715 | 46 cat $pfile $rfile | sort | uniq -u | sed 's/$/,/' | fmt -1000 | sed 's/^/Depends: /' | sed 's/,$/, mercurial, python-pyqt5, python-crypto, libc6/' |
Chris@700 | 47 |
Chris@700 | 48 |