Browse Source

Merge pull request #9231 from jefferyto/byobu-5.129

byobu: Update to 5.129
lilik-openwrt-22.03
Hannu Nyman 6 years ago
committed by GitHub
parent
commit
8fc9775bcb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 42 additions and 411 deletions
  1. +2
    -2
      utils/byobu/Makefile
  2. +0
    -24
      utils/byobu/patches/002-fix-missing-tty-arm-serial-autolaunch.patch
  3. +11
    -0
      utils/byobu/patches/002-fix-missing-tty.patch
  4. +0
    -11
      utils/byobu/patches/003-fix-missing-install.patch
  5. +13
    -0
      utils/byobu/patches/005-monitor-overlay.patch
  6. +11
    -0
      utils/byobu/patches/006-only-pgrep-services.patch
  7. +0
    -13
      utils/byobu/patches/006-pgrep-services.patch
  8. +5
    -14
      utils/byobu/patches/007-count-dropbear-users.patch
  9. +0
    -22
      utils/byobu/patches/008-no-gettext.patch
  10. +0
    -29
      utils/byobu/patches/100-check-if-bashrc-exists.patch
  11. +0
    -34
      utils/byobu/patches/101-fix-tmux-2.8-new-window.patch
  12. +0
    -10
      utils/byobu/patches/102-ensure-disk-exists.patch
  13. +0
    -21
      utils/byobu/patches/103-add-hostname-fallback.patch
  14. +0
    -13
      utils/byobu/patches/104-add-custom-logo.patch
  15. +0
    -21
      utils/byobu/patches/105-handle-processes-stderr.patch
  16. +0
    -11
      utils/byobu/patches/106-fix-release-typo.patch
  17. +0
    -11
      utils/byobu/patches/107-fix-SERVICES.patch
  18. +0
    -39
      utils/byobu/patches/108-custom-updates-available.patch
  19. +0
    -33
      utils/byobu/patches/109-add-whoami-fallback.patch
  20. +0
    -82
      utils/byobu/patches/110-wifi-quality.patch
  21. +0
    -10
      utils/byobu/patches/111-ensure-proc-mdstat-exists.patch
  22. +0
    -11
      utils/byobu/patches/112-fix-session-regex.patch

+ 2
- 2
utils/byobu/Makefile View File

@ -10,12 +10,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=byobu
PKG_VERSION:=5.127
PKG_VERSION:=5.129
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
PKG_SOURCE_URL:=https://launchpad.net/byobu/trunk/$(PKG_VERSION)/+download
PKG_HASH:=4bafc7cb69ff5b0ab6998816d58cd1ef7175e5de75abc1dd7ffd6d5288a4f63b
PKG_HASH:=e5135f20750c359b6371ee87cf2729c6038fbf3a6e66680e67f6a2125b07c2b9
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=COPYING


+ 0
- 24
utils/byobu/patches/002-fix-missing-tty-arm-serial-autolaunch.patch View File

@ -1,24 +0,0 @@
--- a/usr/bin/byobu.in
+++ b/usr/bin/byobu.in
@@ -62,7 +62,7 @@ esac
export BYOBU_BACKEND
# Store the parent tty
-export BYOBU_TTY=$(tty)
+export BYOBU_TTY=$(readlink /proc/$$/fd/0)
# Get the default window name
[ -n "$BYOBU_WINDOW_NAME" ] || BYOBU_WINDOW_NAME=-
--- a/usr/bin/byobu-launch.in
+++ b/usr/bin/byobu-launch.in
@@ -30,8 +30,8 @@
# or edit your sshd_config, ssh_config, and set:
# $HOME/.bashrc: export BYOBU_DISABLE=1
-_tty=$(tty)
-if [ "${_tty#/dev/ttyS}" != "$_tty" ]; then
+_tty=$(readlink /proc/$$/fd/0)
+if [ "${_tty#/dev/ttyS}" != "$_tty" ] && [ "${_tty#/dev/ttyAMA}" != "$_tty" ]; then
# Don't autolaunch byobu on serial consoles
# You can certainly run 'byobu' manually, though
echo

+ 11
- 0
utils/byobu/patches/002-fix-missing-tty.patch View File

@ -0,0 +1,11 @@
--- a/usr/bin/byobu-launch.in
+++ b/usr/bin/byobu-launch.in
@@ -30,7 +30,7 @@
# or edit your sshd_config, ssh_config, and set:
# $HOME/.bashrc: export BYOBU_DISABLE=1
-_tty=$(tty)
+_tty=$(readlink /proc/$$/fd/0)
if [ "${_tty#/dev/ttyS}" != "$_tty" ] && [ "${_tty#/dev/ttyAMA}" != "$_tty" ]; then
# Don't autolaunch byobu on serial consoles
# You can certainly run 'byobu' manually, though

+ 0
- 11
utils/byobu/patches/003-fix-missing-install.patch View File

@ -1,11 +0,0 @@
--- a/usr/bin/byobu-janitor.in
+++ b/usr/bin/byobu-janitor.in
@@ -41,7 +41,7 @@ DEFAULT_PROFILE="light"
PROFILE="$BYOBU_CONFIG_DIR/profile"
# Create byobu-exchange buffer file, with secure permissions, if it doesn't exist
-[ -e "$BYOBU_RUN_DIR/printscreen" ] || install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen"
+[ -e "$BYOBU_RUN_DIR/printscreen" ] || { cp /dev/null "$BYOBU_RUN_DIR/printscreen"; chmod 600 "$BYOBU_RUN_DIR/printscreen"; }
# Affects: users who launched using sudo, such that their config dir
# is not writable by them

+ 13
- 0
utils/byobu/patches/005-monitor-overlay.patch View File

@ -26,3 +26,16 @@
# By default, we won't bug the user with the display of network traffic
# below DISK_IO_THRESHOLD in kB/s; override in $BYOBU_CONFIG_DIR/status
[ -n "$DISK_IO_THRESHOLD" ] || DISK_IO_THRESHOLD=50
--- a/usr/share/byobu/status/statusrc
+++ b/usr/share/byobu/status/statusrc
@@ -36,8 +36,8 @@
# and your lsb_release is "precise", only "p" will be displayed
#RELEASE_ABBREVIATED=1
-# Default: /
-#MONITORED_DISK=/
+# Default: /overlay
+#MONITORED_DISK=/overlay
# Minimum disk throughput that triggers the notification (in kB/s)
# Default: 50

+ 11
- 0
utils/byobu/patches/006-only-pgrep-services.patch View File

@ -0,0 +1,11 @@
--- a/usr/lib/byobu/services
+++ b/usr/lib/byobu/services
@@ -24,6 +24,8 @@ __services_detail() {
}
service_running() {
+ pgrep "$1" >/dev/null
+ return $?
if [ -f "/etc/init/$1.conf" ]; then
# Use upstart
case "$(status $1 2>/dev/null)" in

+ 0
- 13
utils/byobu/patches/006-pgrep-services.patch View File

@ -1,13 +0,0 @@
--- a/usr/lib/byobu/services
+++ b/usr/lib/byobu/services
@@ -24,7 +24,9 @@ __services_detail() {
}
service_running() {
- if [ -f "/etc/init/$1.conf" ]; then
+ if pgrep "$1" >/dev/null; then
+ true
+ elif [ -f "/etc/init/$1.conf" ]; then
# Use upstart
case "$(status $1 2>/dev/null)" in
*running*)

+ 5
- 14
utils/byobu/patches/007-count-dropbear-users.patch View File

@ -1,11 +1,6 @@
--- a/usr/lib/byobu/users
+++ b/usr/lib/byobu/users
@@ -22,20 +22,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__users_detail() {
- ps -ef | grep "sshd:.*@" | grep -v grep
+ ps -ef 2>/dev/null | grep "sshd:.*@" | grep -v grep
@@ -26,7 +26,12 @@ __users_detail() {
}
__users() {
@ -19,15 +14,11 @@
if [ "$USERS_DISTINCT" = "1" ]; then
count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
else
# Note: we'd like to use pgrep -c, however, this isn't available in
@@ -34,6 +39,7 @@ __users() {
# busybox and some distro's pgrep (and it doesn't exit non-zero).
- count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
+ count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l)
+ fi
count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
fi
+ fi
if [ $count -gt 0 ]; then
- color b w r; printf "%d" "$count"; color -; color w r; printf "#"; color --
+ color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
else
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
fi

+ 0
- 22
utils/byobu/patches/008-no-gettext.patch View File

@ -1,22 +0,0 @@
--- a/usr/bin/byobu-export.in
+++ b/usr/bin/byobu-export.in
@@ -22,7 +22,7 @@ PKG="byobu"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
-gettext "
+echo "
The byobu-export utility is now deprecated.
To install byobu on a system for which byobu is not packaged, or
--- a/usr/lib/byobu/menu
+++ b/usr/lib/byobu/menu
@@ -35,7 +35,7 @@ __menu() {
else
key="F9"
fi
- text=$(gettext "Menu" 2>/dev/null) || text="Menu"
+ text="Menu"
color k w; printf "%s:<" "$text"; color -; color b k w; printf "%s" "$key"; color k w; printf ">"
}

+ 0
- 29
utils/byobu/patches/100-check-if-bashrc-exists.patch View File

@ -1,29 +0,0 @@
--- a/usr/bin/byobu-disable-prompt.in
+++ b/usr/bin/byobu-disable-prompt.in
@@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+[ -w "$HOME/.bashrc" ] || exit 1
+
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
--- a/usr/bin/byobu-janitor.in
+++ b/usr/bin/byobu-janitor.in
@@ -112,6 +112,7 @@ killall -u $USER byobu-statusd >/dev/nul
rm -f "$FLAG" "/var/run/screen/S-$USER/$PKG.reload-required"
# Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc
+if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ]; then
if ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then
if eval $BYOBU_TEST diff >/dev/null 2>&1; then
if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then
@@ -123,6 +124,7 @@ if ! (grep -qs "#byobu-prompt#$" "$HOME/
fi
fi
fi
+fi
[ -r "$BYOBU_CONFIG_DIR/prompt" ] || printf "[ -r ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc ] && . ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc #byobu-prompt#\n" > "$BYOBU_CONFIG_DIR/prompt"
# Affects: Upgrades from <= byobu 5.126, clear out ec2/rcs cost statuses

+ 0
- 34
utils/byobu/patches/101-fix-tmux-2.8-new-window.patch View File

@ -1,34 +0,0 @@
--- a/usr/share/byobu/keybindings/f-keys.tmux
+++ b/usr/share/byobu/keybindings/f-keys.tmux
@@ -26,8 +26,8 @@ source $BYOBU_PREFIX/share/byobu/keybind
# Byobu's Keybindings
# Documented in: $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt
-bind-key -n F1 new-window -k -n config byobu-config
-bind-key -n S-F1 new-window -k -n help "sh -c '$BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt'"
+bind-key -n F1 new-window -n config byobu-config
+bind-key -n S-F1 new-window -n help "sh -c '$BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt'"
bind-key -n F2 new-window -c "#{pane_current_path}" \; rename-window "-"
bind-key -n C-F2 display-panes \; split-window -h -c "#{pane_current_path}"
bind-key -n S-F2 display-panes \; split-window -v -c "#{pane_current_path}"
@@ -54,7 +54,7 @@ bind-key -n M-S-Left resize-pane -L
bind-key -n M-S-Right resize-pane -R
bind-key -n F5 source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
bind-key -n M-F5 run-shell '$BYOBU_PREFIX/lib/byobu/include/toggle-utf8' \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
-bind-key -n S-F5 new-window -k "$BYOBU_PREFIX/lib/byobu/include/cycle-status" \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
+bind-key -n S-F5 new-window "$BYOBU_PREFIX/lib/byobu/include/cycle-status" \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
bind-key -n C-F5 send-keys ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets" \; send-keys Enter
bind-key -n C-S-F5 new-window -d "byobu-select-profile -r"
bind-key -n F6 detach
@@ -68,9 +68,9 @@ bind-key -n M-PPage copy-mode \; send-ke
bind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'"
bind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'"
bind-key -n S-F8 next-layout
-bind-key -n M-S-F8 new-window -k "byobu-layout restore; clear; $SHELL"
+bind-key -n M-S-F8 new-window "byobu-layout restore; clear; $SHELL"
bind-key -n C-S-F8 command-prompt -p "Save byobu layout as:" "run-shell \"byobu-layout save '%%'\""
-bind-key -n F9 new-window -k -n config byobu-config
+bind-key -n F9 new-window -n config byobu-config
bind-key -n S-F9 command-prompt -p "Send command to all panes:" "run-shell \"$BYOBU_PREFIX/lib/byobu/include/tmux-send-command-to-all-panes '%%'\""
bind-key -n C-F9 command-prompt -p "Send command to all windows:" "run-shell \"$BYOBU_PREFIX/lib/byobu/include/tmux-send-command-to-all-windows '%%'\""
bind-key -n M-F9 display-panes \; setw synchronize-panes

+ 0
- 10
utils/byobu/patches/102-ensure-disk-exists.patch View File

@ -1,10 +0,0 @@
--- a/usr/lib/byobu/disk_io
+++ b/usr/lib/byobu/disk_io
@@ -53,6 +53,7 @@ __disk_io() {
/dev/*) part="${mount_point}";;
*) part=$(awk '$2 == mp { print $1 ; exit(0); }' "mp=$mount_point" /etc/mtab);;
esac
+ [ -e "$part" ] || return
getdisk "$part"
local disk=${_RET}
local t2=$(date +%s) t1=

+ 0
- 21
utils/byobu/patches/103-add-hostname-fallback.patch View File

@ -1,21 +0,0 @@
--- a/usr/lib/byobu/hostname
+++ b/usr/lib/byobu/hostname
@@ -20,12 +20,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__hostname_detail() {
- hostname -f
+ hostname -f 2>/dev/null
}
__hostname() {
local h=
- h=$(hostname -s 2>/dev/null || hostname)
+ if eval $BYOBU_TEST hostname >/dev/null 2>&1; then
+ h=$(hostname -s 2>/dev/null || hostname)
+ elif [ -r /proc/sys/kernel/hostname ]; then
+ read h < /proc/sys/kernel/hostname
+ fi
if metadata_available; then
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
# Background a retrieval of our public hostname

+ 0
- 13
utils/byobu/patches/104-add-custom-logo.patch View File

@ -1,13 +0,0 @@
--- a/usr/lib/byobu/logo
+++ b/usr/lib/byobu/logo
@@ -111,6 +111,10 @@ __logo() {
logo=" lm "
$MARKUP && printf "$(color g w)$logo$(color -)$(color g w)$(color -) " || printf "$logo"
;;
+ *openwrt*)
+ logo="OWrt"
+ $MARKUP && printf "$(color b colour66 W)%s$(color -)" "$logo" || printf "$logo"
+ ;;
*red*hat*|*rhel*)
logo=" RH "
$MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"

+ 0
- 21
utils/byobu/patches/105-handle-processes-stderr.patch View File

@ -1,21 +0,0 @@
--- a/usr/lib/byobu/processes
+++ b/usr/lib/byobu/processes
@@ -20,15 +20,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__processes_detail() {
- ps -ej
+ ps -ej 2>/dev/null
}
__processes() {
local count=
if [ -r /proc ]; then
- count=$(ls -d /proc/[0-9]* 2>/dev/null| wc -l)
+ count=$(ls -d /proc/[0-9]* 2>/dev/null | wc -l)
else
- count=$(ps -ef | wc -l | awk '{print $1}')
+ count=$(ps -ef | wc -l)
fi
[ -n "$count" ] || return
color b y w; printf "%s" "$count"; color -; color y w; printf "&"; color --

+ 0
- 11
utils/byobu/patches/106-fix-release-typo.patch View File

@ -1,11 +0,0 @@
--- a/usr/lib/byobu/release
+++ b/usr/lib/byobu/release
@@ -30,7 +30,7 @@ __release() {
true
elif [ -r "/etc/os-release" ]; then
# lsb_release is *really* slow; try to use /etc/os-release
- release=$(. /etc/os-release && echo "$VERSION_ID")
+ RELEASE=$(. /etc/os-release && echo "$VERSION_ID")
elif [ -r "/etc/issue" ]; then
# next try /etc/issue first
local issue

+ 0
- 11
utils/byobu/patches/107-fix-SERVICES.patch View File

@ -1,11 +0,0 @@
--- a/usr/lib/byobu/services
+++ b/usr/lib/byobu/services
@@ -45,7 +45,7 @@ service_running() {
}
__services() {
- local services=
+ local services="$SERVICES"
# Users can define a list of services to monitor in $BYOBU_CONFIG_DIR/status
if [ -z "$services" ]; then
if [ -f "/etc/eucalyptus/eucalyptus.conf" ]; then

+ 0
- 39
utils/byobu/patches/108-custom-updates-available.patch View File

@ -1,39 +0,0 @@
--- a/usr/lib/byobu/updates_available
+++ b/usr/lib/byobu/updates_available
@@ -67,9 +67,16 @@ ___update_cache() {
elif eval $BYOBU_TEST pacman >/dev/null; then
# If pacman (Archlinux) exists, use it
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
# 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 &
else
brew outdated | wc -l >$mycache &
@@ -106,6 +113,18 @@ ___update_needed() {
[ "$db" -nt "$mycache" ] && return 0
done
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
# Mac OSX
# check if any new versions have been installed since

+ 0
- 33
utils/byobu/patches/109-add-whoami-fallback.patch View File

@ -1,33 +0,0 @@
--- a/usr/lib/byobu/whoami
+++ b/usr/lib/byobu/whoami
@@ -19,12 +19,28 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+___get_user() {
+ if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
+ whoami
+ elif eval $BYOBU_TEST id >/dev/null 2>&1; then
+ id -un
+ fi
+}
+
__whoami_detail() {
- getent -- passwd "$USER"
+ local user=$(___get_user)
+ [ -n "$user" ] || return
+ if eval $BYOBU_TEST getent >/dev/null 2>&1; then
+ getent -- passwd "$user"
+ else
+ grep "^$user:" /etc/passwd
+ fi
}
__whoami() {
- color bold2; printf "%s@" "$(whoami)"; color -
+ local user=$(___get_user)
+ [ -n "$user" ] || return
+ color bold2; printf "%s@" "$user"; color -
}
# vi: syntax=sh ts=4 noexpandtab

+ 0
- 82
utils/byobu/patches/110-wifi-quality.patch View File

@ -1,82 +0,0 @@
--- a/usr/lib/byobu/wifi_quality
+++ b/usr/lib/byobu/wifi_quality
@@ -19,32 +19,61 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+___get_dev_list() {
+ if [ -n "$MONITORED_NETWORK" ]; then
+ echo "$MONITORED_NETWORK"
+ else
+ iw dev | grep Interface | cut -f2 -d\
+ fi
+}
+
__wifi_quality_detail() {
- /sbin/iwconfig 2>/dev/null
+ if eval $BYOBU_TEST iw >/dev/null 2>&1; then
+ local dev
+ for dev in $(___get_dev_list); do
+ iw dev "$dev" info
+ iw dev "$dev" link
+ echo
+ done
+ elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
+ iwconfig 2>/dev/null
+ fi
}
__wifi_quality() {
local out bitrate quality
- # iwconfig is expected to output lines like:
- # Bit Rate=54 Mb/s Tx-Power=15 dBm
- # Link Quality=60/70 Signal level=-50 dBm
- # the awk below tokenizes the output and prints shell evalable results
- out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
- awk '$0 ~ /[ ]*Link Quality./ {
- sub(/.*=/,"",$2); split($2,a,"/");
- printf "quality=%.0f\n", 100*a[1]/a[2] };
- $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
- '`
- eval "$out"
- [ -z "$bitrate" ] && bitrate="0"
- if [ -z "$quality" ] || [ "$quality" = "0" ]; then
- quality="0"
+ if eval $BYOBU_TEST iw >/dev/null 2>&1; then
+ local dev
+ for dev in $(___get_dev_list); do
+ # signal to quality: https://superuser.com/a/1360447
+ out=`iw dev "$dev" link 2>/dev/null |
+ awk '$0 ~ /^\s*signal:/ { a = 100 * ($2 + 110) / 70;
+ printf "quality=%.0f\n", (a > 100) ? 100 : ((a < 0) ? 0 : a); }
+ $0 ~ /^\s*tx bitrate:/ { printf "bitrate=%s\n", $3; }
+ '`
+ eval "$out"
+ [ -z "$bitrate" ] || [ -z "$quality" ] || break
+ done
+ elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
+ # iwconfig is expected to output lines like:
+ # Bit Rate=54 Mb/s Tx-Power=15 dBm
+ # Link Quality=60/70 Signal level=-50 dBm
+ # the awk below tokenizes the output and prints shell evalable results
+ out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
+ awk '$0 ~ /[ ]*Link Quality./ {
+ sub(/.*=/,"",$2); split($2,a,"/");
+ printf "quality=%.0f\n", 100*a[1]/a[2] };
+ $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
+ '`
+ eval "$out"
fi
- if [ "$bitrate" = "0" ] || [ "$quality" = "0" ] || [ -z "$bitrate" ] || [ -z "$quality"]; then
+ [ -n "$bitrate" ] || bitrate=0
+ [ -n "$quality" ] || quality=0
+ if [ "$bitrate" -gt 0 ] && [ "$quality" -gt 0 ]; then
+ printf "${ICON_WIFI}"; color b C k; printf "%s" "$bitrate"; color -; color C k; printf "%s" "$ICON_MBPS"; color -; color b C k; printf "%s" "$quality"; color -; color C k; printf "%s" "$PCT"; color --
+ else
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/wifi_quality"*
- return
fi
- printf "${ICON_WIFI}"; color b C k; printf "%s" "$bitrate"; color -; color C k; printf "%s" "$ICON_MBPS"; color -; color b C k; printf "%s" "$quality"; color -; color C k; printf "%s" "$PCT"; color --
}
# vi: syntax=sh ts=4 noexpandtab

+ 0
- 10
utils/byobu/patches/111-ensure-proc-mdstat-exists.patch View File

@ -1,10 +0,0 @@
--- a/usr/lib/byobu/raid
+++ b/usr/lib/byobu/raid
@@ -24,6 +24,7 @@ __raid_detail() {
}
__raid() {
+ [ -r /proc/mdstat ] || return
while read line; do
local p msg
# Errors in your raid

+ 0
- 11
utils/byobu/patches/112-fix-session-regex.patch View File

@ -1,11 +0,0 @@
--- a/usr/lib/byobu/session
+++ b/usr/lib/byobu/session
@@ -34,7 +34,7 @@ __session() {
fi
;;
screen)
- local count=$(screen -ls | grep "^ .*\)$" | wc -l)
+ local count=$(screen -ls | grep "^\s\+.*)$" | wc -l)
if [ $count -gt 1 ]; then
color u W k; printf "${ICON_SESSION}%S"; color --
else

Loading…
Cancel
Save