Created
November 14, 2016 11:08
-
-
Save sgpinkus/aaca392bf6ca192cd020327320dfd9b2 to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
fail() { | |
echo "$@" | |
exit 1 | |
} | |
[[ -z "$1" ]] && fail "Usage: $0 <path to file to check>" | |
FILE=`readlink -f "$1"` | |
[[ -f "$FILE" ]] || fail "File must exist. $FILE does not." | |
RFILE=`echo "$FILE" | cut --complement -c 1` | |
PKG=`dpkg -S "$FILE" | cut -f1 -d":"` | |
[[ -z "$PKG" ]] && fail "No package for file '$FILE'" | |
echo "FILE=$FILE/$RFILE; PKG=$PKG; QRY=`dpkg-query -W systemd`" | |
PKGMD5=`dpkg-query --control-show "$PKG" md5sums | grep "$RFILE$"` | |
CURMD5=`md5sum "$FILE"` | |
echo "Current: $CURMD5" | |
echo "Package: $PKGMD5" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment