Created
June 24, 2015 03:41
-
-
Save solarkennedy/7d81f60b05c3bde071e6 to your computer and use it in GitHub Desktop.
Script to print security changelogs on debian/ubuntu systems
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 | |
set -u | |
function analyze_aptget_line { | |
# Inst dpkg [1.16.1.2ubuntu7.5] (1.16.1.2ubuntu7.6 Ubuntu:12.04/precise-security [amd64]) | |
package=$2 | |
current_version="${3//[\[\]]}" | |
latest_version="${4//(}" | |
escaped_version=$(echo $current_version | sed -e 's/[]\/$*.^|[]/\\&/g') | |
echo "Package $package needs to be updated from $current_version to $latest_version:" | |
echo "Abreviated change log till $current_version:" | |
apt-get changelog $package | sed -n "1,/$escaped_version/p" | |
echo | |
} | |
apt-get update | |
grep -r --no-filename security /etc/apt/sources.list* >/tmp/security.list | |
apt-get -s -oDir::Etc::Sourcelist=/tmp/security.list dist-upgrade | grep ^Inst | \ | |
while read package_line; do | |
analyze_aptget_line $package_line | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment