Skip to content

Instantly share code, notes, and snippets.

@konradmb
Last active September 4, 2015 18:51
Show Gist options
  • Save konradmb/280bd9c9d76437693752 to your computer and use it in GitHub Desktop.
Save konradmb/280bd9c9d76437693752 to your computer and use it in GitHub Desktop.
Check for missing files from installed APT packages.
#!/bin/bash
#This script checks for missing files, by scanning through lists of installed files in APT package list.
#Sometimes file is listed in APT .list file, but it's not installed by default, so you need to manually
#check if package needs reinstalling or if it's just a normal condition.
#Tested only on Ubuntu 15.04
#This is only very simple check. To test integrity of installed packages, use debsums.
IFS=$'\n'
for file in /var/lib/dpkg/info/*.list
do
for line in $(cat $file)
do
#If you don't want to scan specific directory, modify this condition and uncomment following lines
#if [[ $line == ]]
#then
# :
#else
[ -e $line ] || echo "Not found: $line from package $(basename $file .list)"
#fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment