support /var/run/updates-available cache available in jaunty

report cpu speed in GHz if we have a calculator
This commit is contained in:
Dustin Kirkland 2008-12-17 23:40:09 -06:00
commit c0f85755bb
3 changed files with 40 additions and 15 deletions

View file

@ -1,3 +1,9 @@
#!/bin/sh
grep -m 1 "^cpu MHz" /proc/cpuinfo | sed "s/^.*: //" | sed "s/\..*$/ MHz/"
mhz=`grep -m 1 "^cpu MHz" /proc/cpuinfo | sed "s/^.*: //" | sed "s/\..*$//"`
if [ $mhz -gt 1000 -a -x /usr/bin/bc ]; then
ghz=$(echo "scale=1; $mhz/1000" | bc)
echo "$ghz GHz"
else
echo "$mhz MHz"
fi

View file

@ -1,20 +1,38 @@
#!/bin/sh
u=
if [ -x /usr/lib/update-notifier/apt-check ]; then
u=`/usr/lib/update-notifier/apt-check 2>&1 | tail -n 1 | sed "s/;.*$//"`
elif [ -x /usr/bin/apt-get ]; then
u=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst`
elif [ -x /usr/bin/yum ]; then
u=`/usr/bin/yum list updates | grep -c "updates"`
else
echo "?"
exit 1
fi
print_updates() {
u=$1
if [ "$u" = "0" ]; then
echo ""
else
echo "$u!"
fi
exit 0
}
cache=/var/run/updates-available
u=
# If global updates-available cache is present, use it. Available as of jaunty.
if [ -r $cache ]; then
u=`grep -m 1 "^[0-9]" $cache | sed "s/\s.*$//"`
print_updates $u
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/;.*$//"`
print_updates $u
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`
fi
# If yum exists, use it
if [ -x /usr/bin/yum ]; then
u=`/usr/bin/yum list updates | grep -c "updates"`
fi
# If we're here, we have no idea
print_updates "?"

1
debian/control vendored
View file

@ -11,6 +11,7 @@ Package: screen-profiles
Architecture: all
Depends: debconf (>= 0.5) | debconf-2.0, screen, gettext-base, debianutils
Recommends: update-notifier-common
Suggests: bc
Description: a set of useful profiles and a profile-switcher for GNU screen
screen-profiles includes a set of profiles for the GNU screen window manager.
These profiles are quite useful on server machines which are not running