* usr/lib/byobu/updates_available:

- Add support for opkg (OpenWrt)
This commit is contained in:
Jeffery To 2019-05-27 03:15:34 +08:00
commit 6e62ff2ffc
2 changed files with 22 additions and 1 deletions

2
debian/changelog vendored
View file

@ -38,6 +38,8 @@ byobu (5.128) unreleased; urgency=medium
- Fix typo - Fix typo
* usr/lib/byobu/services: * usr/lib/byobu/services:
- Fix reading services from $BYOBU_CONFIG_DIR/statusrc - Fix reading services from $BYOBU_CONFIG_DIR/statusrc
* usr/lib/byobu/updates_available:
- Add support for opkg (OpenWrt)
* usr/share/byobu/keybindings/f-keys.tmux: * usr/share/byobu/keybindings/f-keys.tmux:
- Remove -k for new-window. In older versions of tmux, -k without - Remove -k for new-window. In older versions of tmux, -k without
-t <target-window> had no effect. In tmux 2.8, -k without -t will -t <target-window> had no effect. In tmux 2.8, -k without -t will

View file

@ -67,9 +67,16 @@ ___update_cache() {
elif eval $BYOBU_TEST pacman >/dev/null; then elif eval $BYOBU_TEST pacman >/dev/null; then
# If pacman (Archlinux) exists, use it # If pacman (Archlinux) exists, use it
LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null & LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null &
elif eval $BYOBU_TEST opkg >/dev/null; then
# If opkg (OpenWrt) exists, use it, also background if flock exists
if eval $BYOBU_TEST flock >/dev/null; then
flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null &
else
opkg list-upgradable | wc -l >$mycache &
fi
elif eval $BYOBU_TEST brew >/dev/null; then elif eval $BYOBU_TEST brew >/dev/null; then
# If homebrew (Mac OSX) exists, use it, also background if flock exists # If homebrew (Mac OSX) exists, use it, also background if flock exists
if eval $BYOBU_TEST flock; then if eval $BYOBU_TEST flock >/dev/null; then
flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null & flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &
else else
brew outdated | wc -l >$mycache & brew outdated | wc -l >$mycache &
@ -106,6 +113,18 @@ ___update_needed() {
[ "$db" -nt "$mycache" ] && return 0 [ "$db" -nt "$mycache" ] && return 0
done done
return 1 return 1
elif eval $BYOBU_TEST opkg >/dev/null; then
# OpenWrt
[ ! -e /var/lock/opkg.lock ] || return 1
if [ -d /var/opkg-lists ]; then
[ /var/opkg-lists -nt "$mycache" ]
return $?
else
local u s
read u s < "$mycache"
[ "$u" -gt 0 ]
return $?
fi
elif eval $BYOBU_TEST brew >/dev/null; then elif eval $BYOBU_TEST brew >/dev/null; then
# Mac OSX # Mac OSX
# check if any new versions have been installed since # check if any new versions have been installed since