-apt-listbugs -s $SEVERITY list \
- $(apt-show-source | grep -v -e 'not installed' -e '--------------' -e \
- 'Version' | awk '{print $4;}' | grep -v '^[() ]*$'| sort | uniq)
+if ! [ -x /usr/bin/dpkg-query ] ; then
+ echo "Error: /usr/bin/dpkg-query not available. Exiting."
+ exit 1
+fi
+
+if apt-show-source 1>/dev/null 2>&1 ; then
+ apt-listbugs -q -n -s $SEVERITY list \
+ $(apt-show-source | grep -v -e 'not installed' -e '--------------' -e \
+ 'Version' | awk '{print $4;}' | grep -v '^[() ]*$'| sort | uniq)
+else
+ apt-listbugs -q -n -s $SEVERITY list $(dpkg-query -W --showformat='${Package}\n')
+fi