fixes for Bug #332890

This is the screen-profiles half of the problem.  Prefer /var/run/updates-available over local cache, if it has been touched more recently.

We also need apt-get/dpkg to update /var/run/updates-available upon completion
This commit is contained in:
Dustin Kirkland 2009-02-23 14:46:30 -06:00
commit aed6f0d1e8
2 changed files with 13 additions and 7 deletions

View file

@ -40,10 +40,15 @@ print_updates() {
cache=/var/run/updates-available
mycache=$HOME/.screenrc-updates-available
now=`date +%s`
cache_timestamp=`stat -c "%Y" $cache 2>/dev/null || echo 0`
mycache_timestamp=`stat -c "%Y" $mycache 2>/dev/null || echo 0`
diff=`expr $now - $cache_timestamp`
u=
# If global updates-available cache is present, use it.
# If global updates-available cache is present, and newer than mycache, and
# within expiration, use it.
# Only available in Jaunty+.
if [ -r $cache ]; then
if [ -r $cache -a $cache_timestamp -gt $mycache_timestamp -a $diff -lt $EXPIRATION ]; then
u=`grep -m 1 "^[0-9]" $cache | sed "s/\s.*$//"`
s=`grep -m 2 "^[0-9]" $cache | tail -n 1 | sed "s/\s.*$//"`
print_updates $u $s
@ -52,9 +57,7 @@ fi
# If the user's updates-available cache is present, and less than an hour old,
# use it. (The "hour" part should be configurable)
if [ -r $mycache -a -O $mycache ]; then
now=`date +%s`
timestamp=`stat -c "%Y" $mycache`
diff=`expr $now - $timestamp`
diff=`expr $now - $mycache_timestamp`
if [ $diff -lt $EXPIRATION ]; then
print_updates `cat $mycache`
fi

7
debian/changelog vendored
View file

@ -1,4 +1,4 @@
screen-profiles (1.27) UNRELEASED; urgency=low
screen-profiles (1.27-0ubuntu1) jaunty; urgency=low
* Fix for LP: #333189:
- keybindings/common: add profile reload shortcut, "ctrl-a ~"
@ -7,8 +7,11 @@ screen-profiles (1.27) UNRELEASED; urgency=low
* Fix for LP: #333180
- screen-profiles: add toggle for auto launch of welcome
- po/*: updated for the new messages
* Fix for LP: #332890
- bin/updates-available: prefer /var/run/updates-available over
~/.screenrc-updates-available, if touched more recently
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 23 Feb 2009 14:25:02 -0600
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 23 Feb 2009 14:44:05 -0600
screen-profiles (1.26-0ubuntu1) jaunty; urgency=low