* usr/lib/byobu/updates_available:

- use run-one, rather than run-this-one (which isn't working well)
This commit is contained in:
Dustin Kirkland 2012-06-08 17:04:23 -05:00
commit 99b436cc37
2 changed files with 10 additions and 8 deletions

2
debian/changelog vendored
View file

@ -5,6 +5,8 @@ byobu (5.19) unreleased; urgency=low
* === added directory usr/share/sounds, === added directory
usr/share/sounds/byobu, usr/share/sounds/byobu/byobu.ogg: LP: #999716
- add byobu sound to repo, as pronounced by Fumihito YOSHIDA
* usr/lib/byobu/updates_available:
- use run-one, rather than run-this-one (which isn't working well)
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 11 May 2012 15:43:02 -0700

View file

@ -39,7 +39,7 @@ ___print_updates() {
}
___update_cache() {
local mycache=$1 RUN_THIS_ONE=
local mycache=$1 RUN_ONE=
# Now we actually have to do hard computational work to calculate updates.
# Let's try to be "nice" about it:
renice 10 $$ >/dev/null 2>&1 || true
@ -49,26 +49,26 @@ ___update_cache() {
# and let the next cache check pick up the results.
# Also, try to ensure that no more than one of these run at
# a given time; install the run-one package.
command -v run-this-one >/dev/null && RUN_THIS_ONE=run-this-one
command -v run-one >/dev/null && RUN_ONE=run-one
if [ -x /usr/lib/update-notifier/apt-check ]; then
# If apt-check binary exists, use it
$RUN_THIS_ONE /usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print $1, $2 }' > "$mycache" &
$RUN_ONE /usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print $1, $2 }' > "$mycache" &
elif command -v apt-get >/dev/null; then
# If apt-get exists, use it
$RUN_THIS_ONE apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst > $mycache &
$RUN_ONE apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst > $mycache &
elif command -v pkcon >/dev/null; then
# use packagekit to show list of packages
$RUN_THIS_ONE pkcon get-updates -p | grep -c '^Package' > "$mycache" &
$RUN_ONE pkcon get-updates -p | grep -c '^Package' > "$mycache" &
elif command -v zypper >/dev/null; then
# If zypper exists, use it
$RUN_THIS_ONE zypper --no-refresh lu --best-effort | grep -c 'v |' > $mycache &
$RUN_ONE zypper --no-refresh lu --best-effort | grep -c 'v |' > $mycache &
elif command -v yum >/dev/null; then
# If yum exists, use it
# TODO: We need a better way of counting updates available from a RH expert
$RUN_THIS_ONE yum list updates -q | grep -vc "Updated Packages" > $mycache &
$RUN_ONE yum list updates -q | grep -vc "Updated Packages" > $mycache &
elif command -v pacman >/dev/null; then
# If pacman (Archlinux) exists, use it
LC_ALL=C $RUN_THIS_ONE pacman -Sup | grep -vc "^\(::\| \)" > $mycache &
LC_ALL=C $RUN_ONE pacman -Sup | grep -vc "^\(::\| \)" > $mycache &
fi
}