* bin/updates-available: write out local cache of updates available; add !

only if there are security updates
This commit is contained in:
Dustin Kirkland 2009-02-05 00:27:57 +01:00
commit 86abfdc0fa
2 changed files with 22 additions and 8 deletions

View file

@ -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

9
debian/changelog vendored
View file

@ -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 <kirkland@ubuntu.com> Tue, 03 Feb 2009 14:18:02 +0100
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 05 Feb 2009 00:27:16 +0100
screen-profiles (1.19-0ubuntu1) jaunty; urgency=low