Created
June 1, 2011 17:01
-
-
Save thepaul/1002763 to your computer and use it in GitHub Desktop.
extract and output the changelog from a .deb file, when possible
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
changelog_from_deb () { | |
# won't work when packages symlink their docs from another package from the same source; | |
# you'll get "No changelog found." | |
t="$(mktemp -d)" | |
p="$(dpkg-deb -f "$1" Package)" | |
fail=1 | |
dpkg-deb --fsys-tarfile "$1" | \ | |
tar -x --wildcards -C $t ./usr/share/doc/"$p"/changelog\* 2>/dev/null | |
for f in changelog.Debian.gz changelog.gz; do | |
if [ -e "$t/usr/share/doc/$p/$f" ]; then | |
gzip -dc < "$t/usr/share/doc/$p/$f" | |
fail=0 | |
break | |
fi | |
done | |
rm -rf $t | |
[ $fail -eq 0 ] || echo "No changelog found." >&2 | |
return $fail | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For .rpm that would be
rpm -qp --changelog "$1"