diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-10-14 09:33:07 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-10-14 09:33:07 +0200 |
commit | b06b9f60109ad152e8a6ce8c20f9266648d9d70f (patch) | |
tree | 65199dc8d398671431f0fa5af6b65325dacde09e /lddd.in | |
parent | 9715ddbe9df6e7a2a37a11c4f3e90a5446459217 (diff) | |
parent | a0c6bf4556e211037b9d9d6de3fd17f798a3c1fb (diff) |
Merge remote-tracking branch 'cryptocrack/for-pierre'
Diffstat (limited to 'lddd.in')
-rw-r--r-- | lddd.in | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -0,0 +1,46 @@ +#!/bin/sh +# +# lddd - find broken library links on your machine +# + +ifs=$IFS +IFS="${IFS}:" + +libdirs="/lib /usr/lib /usr/local/lib $(cat /etc/ld.so.conf.d/*)" +extras= + +TEMPDIR=$(mktemp -d --tmpdir lddd-script.XXXX) + +echo 'Go out and drink some tea, this will take a while :) ...' +# Check ELF binaries in the PATH and specified dir trees. +for tree in $PATH $libdirs $extras; do + echo DIR $tree + + # Get list of files in tree. + files=$(find $tree -type f ! -name '*.a' ! -name '*.la' ! -name '*.py*' ! -name '*.txt' ! -name '*.h' ! -name '*.ttf' ! \ + -name '*.rb' ! -name '*.ko' ! -name '*.pc' ! -name '*.enc' ! -name '*.cf' ! -name '*.def' ! -name '*.rules' ! -name \ + '*.cmi' ! -name '*.mli' ! -name '*.ml' ! -name '*.cma' ! -name '*.cmx' ! -name '*.cmxa' ! -name '*.pod' ! -name '*.pm' \ + ! -name '*.pl' ! -name '*.al' ! -name '*.tcl' ! -name '*.bs' ! -name '*.o' ! -name '*.png' ! -name '*.gif' ! -name '*.cmo' \ + ! -name '*.cgi' ! -name '*.defs' ! -name '*.conf' ! -name '*_LOCALE' ! -name 'Compose' ! -name '*_OBJS' ! -name '*.msg' ! \ + -name '*.mcopclass' ! -name '*.mcoptype') + IFS=$ifs + for i in $files; do + if [ $(file $i | grep -c 'ELF') -ne 0 ]; then + # Is an ELF binary. + if [ $(ldd $i 2>/dev/null | grep -c 'not found') -ne 0 ]; then + # Missing lib. + echo "$i:" >> $TEMPDIR/raw.txt + ldd $i 2>/dev/null | grep 'not found' >> $TEMPDIR/raw.txt + fi + fi + done +done +grep '^/' $TEMPDIR/raw.txt | sed -e 's/://g' >> $TEMPDIR/affected-files.txt +# invoke pacman +for i in $(cat $TEMPDIR/affected-files.txt); do + pacman -Qo $i | awk '{print $4,$5}' >> $TEMPDIR/pacman.txt +done +# clean list +sort -u $TEMPDIR/pacman.txt >> $TEMPDIR/possible-rebuilds.txt + +echo "Files saved to $TEMPDIR" |