/etc/apt/grml/listbugs: support non-apt-show-versions
[grml-etc-core.git] / etc / apt / grml / listbugs
1 #!/bin/sh
2 # Filename:      /etc/apt/listbugs
3 # Purpose:       display bugs of currently running system (used inside grml-live)
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 # Latest change: Son Okt 14 11:49:36 CEST 2007 [mika]
8 ################################################################################
9
10 [ -n "$SEVERITY" ] || SEVERITY="critical,grave,serious"
11
12 if ! [ -x /usr/sbin/apt-listbugs ] ; then
13    echo "Error: /usr/sbin/apt-listbugs not available. Exiting."
14    exit 1
15 fi
16
17 if ! [ -x /usr/bin/apt-show-source ] ; then
18    echo "Error: /usr/bin/apt-show-source not available. Exiting."
19    exit 1
20 fi
21
22 if ! [ -x /usr/bin/dpkg-query ] ; then
23    echo "Error: /usr/bin/dpkg-query not available. Exiting."
24    exit 1
25 fi
26
27 if apt-show-source 1>/dev/null 2>&1 ; then
28    apt-listbugs -q -n -s $SEVERITY list \
29       $(apt-show-source | grep -v -e 'not installed' -e '--------------' -e \
30       'Version' | awk '{print $4;}' | grep -v '^[() ]*$'| sort | uniq)
31 else
32    apt-listbugs -q -n -s $SEVERITY list $(dpkg-query -W --showformat='${Package}\n')
33 fi
34
35 # $ROOTCMD apt-listbugs -s $SEVERITY list \
36 #          $(dpkg --get-selections| grep '       install' | awk '{print $1})
37
38 ## END OF FILE #################################################################