Comment 2 for bug 316452

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.

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"';\
      echo File "$0" missing from package '"$PAK"';\