mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-23 06:36:17 -07:00
usr/lib/byobu/updates_available: add support for ArchLinux in the
updates-available script, LP: #767546
This commit is contained in:
parent
45bc3240f0
commit
94e57410c5
2 changed files with 28 additions and 11 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -1,6 +1,8 @@
|
||||||
byobu (3.34) unreleased; urgency=low
|
byobu (3.34) unreleased; urgency=low
|
||||||
|
|
||||||
* UNRELEASED
|
[ https://launchpad.net/~zorun-42 ]
|
||||||
|
* usr/lib/byobu/updates_available: add support for ArchLinux in the
|
||||||
|
updates-available script, LP: #767546
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 19 Apr 2011 16:34:35 -0400
|
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 19 Apr 2011 16:34:35 -0400
|
||||||
|
|
||||||
|
|
|
@ -72,14 +72,31 @@ update_cache() {
|
||||||
# If yum exists, use it
|
# If yum exists, use it
|
||||||
# TODO: We need a better way of counting updates available from a RH expert
|
# TODO: We need a better way of counting updates available from a RH expert
|
||||||
yum list updates -q | grep -vc "Updated Packages" > $mycache &
|
yum list updates -q | grep -vc "Updated Packages" > $mycache &
|
||||||
|
elif which pacman >/dev/null; then
|
||||||
|
# If pacman (Archlinux) exists, use it
|
||||||
|
LC_ALL=C pacman -Sup | grep -vc "^\(::\| \)" > $mycache &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
PKG="byobu"
|
# Checks if we need to update the cache.
|
||||||
|
# TODO: add more distro
|
||||||
# The following is somewhat Ubuntu and Debian specific (apt).
|
update_needed() {
|
||||||
# I would welcome contributions from other distros to make this
|
mycache=$1
|
||||||
# more distro-agnostic.
|
# The cache doesn't exist: create it
|
||||||
|
[ ! -e "$mycache" ] && return 0
|
||||||
|
if which apt-get >/dev/null; then
|
||||||
|
# Debian/ubuntu
|
||||||
|
[ "/var/lib/apt" -nt "$mycache" ] || [ "/var/lib/apt/lists" -nt "$mycache" ]
|
||||||
|
return $?
|
||||||
|
elif which pacman >/dev/null; then
|
||||||
|
# Archlinux
|
||||||
|
for db in /var/lib/pacman/sync/*.db; do
|
||||||
|
[ "$db" -nt "$mycache" ] && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA"
|
[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA"
|
||||||
mycache="$DIR/$PKG.updates-available"
|
mycache="$DIR/$PKG.updates-available"
|
||||||
|
@ -87,8 +104,6 @@ mycache="$DIR/$PKG.updates-available"
|
||||||
# If mycache is present, use it
|
# If mycache is present, use it
|
||||||
[ -r $mycache ] && print_updates `grep "^[0-9]" $mycache | sed "s/ .*$//"`
|
[ -r $mycache ] && print_updates `grep "^[0-9]" $mycache | sed "s/ .*$//"`
|
||||||
|
|
||||||
# Update the cache if necessary
|
# If we really need to do so (mycache doesn't exist, or the package database has changed),
|
||||||
if [ ! -e "$mycache" ] || [ "/var/lib/apt" -nt "$mycache" ] || [ "/var/lib/apt/lists" -nt "$mycache" ]; then
|
# background an update now
|
||||||
# If apt is newer than mycache, background an update now
|
update_needed "$mycache" && update_cache "$mycache"
|
||||||
update_cache "$mycache"
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue