blob: 8dcf5314d3d74517cfa9068e4cb452481f4f13d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/bash
#
# Copyright (c) 2012, Al Stone <ahs3@ahs3.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 (only) of the GNU General
# Public License as published by the Free Software Foundation.
#
#
# Sort through the raw results of a scan and list all of
# packages found and their reported versions
#
if [ "$#" -lt 1 ]
then
echo "usage: ./report-versions.sh <results-file>"
exit 1
fi
data="$1"
if [ ! -s "$data" ]
then
echo "? has to be something to work with"
exit 1
fi
cat "$data" | (
declare -i count
count=0
while IFS='' read -r line || [ -n "$line" ]
do
case "$line" in
Package:*)
[ $count -gt 0 ] && echo $pkg $version
count+=1
pkg=$(echo $line | sed 's/Package: //')
;;
Source:*)
version=$(echo $line | sed 's/Source: //' | \
sed "s/${pkg}-//")
;;
esac
done
)
|