Comment 2 for bug 316452

Revision history for this message
Bogdan Butnaru (bogdanb) wrote :

Just in case somebody needs this, the script below will display missing files from your computer (in the sense that dpkg believes a package supplies a certain file, but the file either doesn't exist or is a dangling symlink). It found quite a few problems, but I didn't have time to figure out what's wrong with each and report them.

#!/bin/bash
for PAK in `dpkg-query -W -f='${Package} '`; do
 dpkg-query -L $PAK \
  | sed 's/diverted by [^:]*: //;s/package diverts others to: //' \
  | xargs -I {} \
   bash -c '\
    if [ ! -e "$0" ] ; then \
     if [ -L "$0" ]; then \
      echo Dangling link "$0" in package '"$PAK"';\
     else
      echo File "$0" missing from package '"$PAK"';\
     fi;\
    fi'\
   {}
 #break
done