From 86abfdc0fa98c296185f2b58fbd8de1202e6af13 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 5 Feb 2009 00:27:57 +0100 Subject: [PATCH] * bin/updates-available: write out local cache of updates available; add ! only if there are security updates --- bin/updates-available | 21 ++++++++++++++------- debian/changelog | 9 ++++++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/bin/updates-available b/bin/updates-available index 7d24dbda..f84858ea 100755 --- a/bin/updates-available +++ b/bin/updates-available @@ -23,9 +23,16 @@ EXPIRATION=3600 print_updates() { u=$1 + s=$2 if [ -n "$u" ]; then if [ "$u" -gt 0 ]; then - echo "$u!" + echo -n "$u" + if [ -n "$s" ]; then + if [ "$s" -gt 0 ]; then + echo -n "!" + fi + fi + echo fi fi exit 0 @@ -38,7 +45,8 @@ u= # Only available in Jaunty+. if [ -r $cache ]; then u=`grep -m 1 "^[0-9]" $cache | sed "s/\s.*$//"` - print_updates $u + s=`grep -m 2 "^[0-9]" $cache | tail -n 1 | sed "s/\s.*$//"` + print_updates $u $s fi # If the user's updates-available cache is present, and less than an hour old, @@ -48,13 +56,12 @@ if [ -r $mycache -a -O $mycache ]; then timestamp=`stat -c "%Y" $mycache` diff=`expr $now - $timestamp` if [ $diff -lt $EXPIRATION ]; then - u=`grep -m 1 "^[0-9]" $mycache | sed "s/\s.*$//"` - echo $u > $mycache - print_updates $u + print_updates `cat $mycache` fi else # Otherwise, let's quickly clear the cache, and then recreate it with # a really old timestamp (so that it get's updated on next run) + # and exit immediately rm -f $mycache touch -t 197001010000 $mycache exit 0 @@ -62,7 +69,7 @@ fi # If apt-check binary exists, use it if [ -x /usr/lib/update-notifier/apt-check ]; then - u=`/usr/lib/update-notifier/apt-check 2>&1 | tail -n 1 | sed "s/;.*$//" | tee $mycache` + u=`/usr/lib/update-notifier/apt-check 2>&1 | tail -n 1 | sed "s/;/ /"` echo $u > $mycache print_updates $u fi @@ -70,7 +77,7 @@ fi # If apt-get exists, use it if [ -x /usr/bin/apt-get ]; then u=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst` - echo "$u" > $mycache + echo $u > $mycache print_updates $u fi diff --git a/debian/changelog b/debian/changelog index f22437d4..68a62b01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,15 @@ screen-profiles (1.20) UNRELEASED; urgency=low * profiles/logos/*: remove unneeded trailing formatting + * screen-launcher-install: no longer need the pruning code, since we just + call screen-launcher-uninstall + * bin/*: added gpl/copyright header + * bin/ec2-cost, profiles/common, debian/install: initial script for + estimating ec2 cost + * bin/updates-available: write out local cache of updates available; add ! + only if there are security updates - -- Dustin Kirkland Tue, 03 Feb 2009 14:18:02 +0100 + -- Dustin Kirkland Thu, 05 Feb 2009 00:27:16 +0100 screen-profiles (1.19-0ubuntu1) jaunty; urgency=low