mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 06:23:19 -07:00
* bin/updates-available: write out local cache of updates available; add !
only if there are security updates
This commit is contained in:
parent
81a7202c6d
commit
86abfdc0fa
2 changed files with 22 additions and 8 deletions
|
@ -23,9 +23,16 @@ EXPIRATION=3600
|
||||||
|
|
||||||
print_updates() {
|
print_updates() {
|
||||||
u=$1
|
u=$1
|
||||||
|
s=$2
|
||||||
if [ -n "$u" ]; then
|
if [ -n "$u" ]; then
|
||||||
if [ "$u" -gt 0 ]; 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
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -38,7 +45,8 @@ u=
|
||||||
# Only available in Jaunty+.
|
# Only available in Jaunty+.
|
||||||
if [ -r $cache ]; then
|
if [ -r $cache ]; then
|
||||||
u=`grep -m 1 "^[0-9]" $cache | sed "s/\s.*$//"`
|
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
|
fi
|
||||||
|
|
||||||
# If the user's updates-available cache is present, and less than an hour old,
|
# 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`
|
timestamp=`stat -c "%Y" $mycache`
|
||||||
diff=`expr $now - $timestamp`
|
diff=`expr $now - $timestamp`
|
||||||
if [ $diff -lt $EXPIRATION ]; then
|
if [ $diff -lt $EXPIRATION ]; then
|
||||||
u=`grep -m 1 "^[0-9]" $mycache | sed "s/\s.*$//"`
|
print_updates `cat $mycache`
|
||||||
echo $u > $mycache
|
|
||||||
print_updates $u
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Otherwise, let's quickly clear the cache, and then recreate it with
|
# 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)
|
# a really old timestamp (so that it get's updated on next run)
|
||||||
|
# and exit immediately
|
||||||
rm -f $mycache
|
rm -f $mycache
|
||||||
touch -t 197001010000 $mycache
|
touch -t 197001010000 $mycache
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -62,7 +69,7 @@ fi
|
||||||
|
|
||||||
# If apt-check binary exists, use it
|
# If apt-check binary exists, use it
|
||||||
if [ -x /usr/lib/update-notifier/apt-check ]; then
|
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
|
echo $u > $mycache
|
||||||
print_updates $u
|
print_updates $u
|
||||||
fi
|
fi
|
||||||
|
@ -70,7 +77,7 @@ fi
|
||||||
# If apt-get exists, use it
|
# If apt-get exists, use it
|
||||||
if [ -x /usr/bin/apt-get ]; then
|
if [ -x /usr/bin/apt-get ]; then
|
||||||
u=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst`
|
u=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst`
|
||||||
echo "$u" > $mycache
|
echo $u > $mycache
|
||||||
print_updates $u
|
print_updates $u
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
9
debian/changelog
vendored
9
debian/changelog
vendored
|
@ -1,8 +1,15 @@
|
||||||
screen-profiles (1.20) UNRELEASED; urgency=low
|
screen-profiles (1.20) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* profiles/logos/*: remove unneeded trailing formatting
|
* 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
|
screen-profiles (1.19-0ubuntu1) jaunty; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue