#!/bin/bash

# Author: Kees Cook <kees@ubuntu.com>
# Author: Jamie Strandboge <jamie@ubuntu.com>
# Copyright (C) 2005-2008 Canonical Ltd.
#
# This script is distributed under the terms and conditions of the GNU General
# Public License, Version 2 or later. See http://www.gnu.org/copyleft/gpl.html
# for details.

# Reports a terse numeric of CVEs that need attention for supported packages.

universe=""
if [ "x$1" = "x--universe" ]; then
    shift || true
    universe="-v"
fi

nodevel=""
if [ "x$1" = "x-S" ] || [ "x$1" = "x--skip-devel" ]; then
    shift || true
    nodevel="-S"
fi

PRIOS="critical high medium low"
WANTED="$1"
if [ -n "$WANTED" ]; then
    PRIOS="$WANTED"
fi

OUT=""
for prio in $PRIOS
do
    if [ -z "$WANTED" ]; then
        echo ""
        echo "$prio ..."
    fi
    ./scripts/ubuntu-table -s $nodevel | egrep $universe '(SUP|COM)' | grep ' '"$prio"'$'
done
