mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-14 18:57:20 -07:00
* usr/lib/byobu/updates_available:
- Fix rare race condition for update_needed and cache file (#26) - https://github.com/dustinkirkland/byobu/pull/26
This commit is contained in:
parent
24d6686dfe
commit
0a44bf2158
2 changed files with 17 additions and 5 deletions
7
debian/changelog
vendored
7
debian/changelog
vendored
|
@ -14,8 +14,11 @@ byobu (5.126) unreleased; urgency=medium
|
|||
- BUG: #892489
|
||||
* usr/lib/byobu/include/shutil, usr/lib/byobu/logo:
|
||||
- add a logo for gLinux
|
||||
* usr/lib/byobu/updates_available,
|
||||
usr/share/byobu/desktop/byobu.desktop:
|
||||
|
||||
[ Mark Kelly ]
|
||||
* usr/lib/byobu/updates_available:
|
||||
- Fix rare race condition for update_needed and cache file (#26)
|
||||
- https://github.com/dustinkirkland/byobu/pull/26
|
||||
|
||||
[ Didier Roche ]
|
||||
* byobu.desktop:
|
||||
|
|
|
@ -50,7 +50,7 @@ ___update_cache() {
|
|||
# Ensure that no more than one of these run at a given time
|
||||
if [ -x /usr/lib/update-notifier/apt-check ]; then
|
||||
# If apt-check binary exists, use it
|
||||
flock -xn "$flock" /usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print $1, $2 }' >"$mycache" 2>/dev/null &
|
||||
flock -xn "$flock" sh -c "(/usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print \$1, \$2 }' >\"${mycache}-x\" 2>/dev/null ; mv \"${mycache}-x\" \"$mycache\")" &
|
||||
elif eval $BYOBU_TEST apt-get >/dev/null; then
|
||||
# If apt-get exists, use it
|
||||
flock -xn "$flock" apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst >$mycache 2>/dev/null &
|
||||
|
@ -85,8 +85,17 @@ ___update_needed() {
|
|||
[ ! -e "$mycache" ] && return 0
|
||||
if eval $BYOBU_TEST apt-get >/dev/null; then
|
||||
# Debian/ubuntu
|
||||
[ "/var/lib/apt" -nt "$mycache" ] || [ "/var/lib/apt/lists" -nt "$mycache" ]
|
||||
return $?
|
||||
d0=$(($(stat -c %Y $mycache 2>/dev/null)-5))
|
||||
d1=$(stat -c %Y /var/lib/apt)
|
||||
d2=$(stat -c %Y /var/lib/apt/lists)
|
||||
d3=$(stat -c %Y /var/log/dpkg.log)
|
||||
now=$(date +%s)
|
||||
delta=$(($now-$d0))
|
||||
if [ $d0 -lt 0 ] || [ $d0 -lt $d1 ] || [ $d0 -lt $d2 ] || [ $d0 -lt $d3 ] || [ 3605 -lt $delta ] ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
elif [ -e "/var/lib/PackageKit/transactions.db" ]; then
|
||||
[ "/var/lib/PackageKit/transactions.db" -nt "$mycache" ]
|
||||
return $?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue