Created
October 21, 2011 14:02
-
-
Save jorrizza/1303932 to your computer and use it in GitHub Desktop.
Debian broken package finder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BROKEN="" | |
IFS=" | |
" | |
for package in `dpkg -l | awk '{ if ($1 == "ii") { print $2 } }'`; do | |
STATUS="Okay" | |
printf "Checking %s..." $package | |
for file in `dpkg -L $package | awk -F": " '{ if ($2) { print $2 } else { print $1 } }'`; do | |
if [ ! -e "$file" ]; then | |
STATUS="Broken" | |
fi | |
done | |
printf "%s\n" $STATUS | |
if [ $STATUS = "Broken" ]; then | |
BROKEN="$package $BROKEN" | |
fi | |
done | |
printf "Broken packages: %s\n" "$BROKEN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment