~ubuntu-security/ubuntu-cve-tracker/master

« back to all changes in this revision

Viewing changes to scripts/pkg_status

  • Committer: Steve Beattie
  • Date: 2019-02-19 06:18:27 UTC
  • Revision ID: sbeattie@ubuntu.com-20190219061827-oh57fzcfc1u9dlfk
The ubuntu-cve-tracker project has been converted to git.

Please use 'git clone https://git.launchpad.net/ubuntu-cve-tracker' to
get the converted tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
# Author: Jamie Strandboge <jamie@ubuntu.com>
4
 
# Author: Kees Cook <kees@ubuntu.com>
5
 
# Copyright (C) 2005-2016 Canonical Ltd.
6
 
#
7
 
# This script is distributed under the terms and conditions of the GNU General
8
 
# Public License, Version 2 or later. See http://www.gnu.org/copyleft/gpl.html
9
 
# for details.
10
 
 
11
 
set -e
12
 
 
13
 
#
14
 
# Usage:
15
 
# ./scripts/pkg_status pkgname1 pkgname2 ...
16
 
#
17
 
# ./scripts/pkg_status -f pkgname1 pkgname2 ... (full listing)
18
 
#
19
 
 
20
 
help() {
21
 
    cat <<EOM
22
 
./scripts/pkg_status [-f] [-r REL] pkgname1 pkgname2 ...
23
 
EOM
24
 
}
25
 
 
26
 
showfull="no"
27
 
only_release=
28
 
while getopts "hfr:" opt ; do
29
 
    case "$opt" in
30
 
        f) showfull="yes";;
31
 
        r) only_release="--no-retired --only-release=$OPTARG";;
32
 
        h) help ; exit 0;;
33
 
        ?) help;;
34
 
    esac
35
 
done
36
 
 
37
 
if [ -z "$1" ]; then
38
 
        echo "Need to specific a source package name"
39
 
        exit 1
40
 
fi
41
 
 
42
 
pkgs=""
43
 
for p in "$@"; do
44
 
        echo "$p" | egrep '^[a-zA-Z0-9]' >/dev/null 2>&1 || continue
45
 
        pkgs="${pkgs} -p ${p}"
46
 
done
47
 
if [ "$showfull" = "yes" ]; then
48
 
        CVES=$(./scripts/ubuntu-table $only_release --supported $pkgs 2>/dev/null | sort -k 2 | grep -v '^ ' | awk '{print $1}')
49
 
        echo "$CVES" | xargs ./scripts/cve_status -f
50
 
else
51
 
        REPORT=$(./scripts/ubuntu-table $only_release --supported $pkgs 2>/dev/null)
52
 
        if [ -n "$REPORT" ]; then
53
 
                echo "$REPORT" | head -n1
54
 
                echo "$REPORT" | tail -n +2 | sort -n
55
 
        fi
56
 
fi