From fd943656b4a4194eff47151b5b8df4a93e70a928 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Wed, 6 May 2009 20:39:28 -0500 Subject: [PATCH] * bin/updates-available: add a --short option, which only displays the number of updates available; show more info on --detail about upgrades Note: this will need to be improved for non Debian distros! Signed-off-by: Dustin Kirkland --- bin/updates-available | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/updates-available b/bin/updates-available index 98af836a..2be75add 100755 --- a/bin/updates-available +++ b/bin/updates-available @@ -17,13 +17,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if [ "$1" = "--detail" ]; then +if [ "$1" = "--detail" -o "$1" = "--short" ]; then if [ -x "/usr/bin/apt-get" ]; then - out=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade | grep ^Inst | sed "s/^Inst //"` - if [ -z "$out" ]; then - printf "None" + detail=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade` + if [ "$1" = "--detail" ]; then + printf "$detail" else - printf "$out" + short=`printf "$detail" | grep ^Inst | wc -l` + printf "$short" fi fi exit 0