diff --git a/utils/byobu/Makefile b/utils/byobu/Makefile new file mode 100644 index 000000000..d7860e85a --- /dev/null +++ b/utils/byobu/Makefile @@ -0,0 +1,102 @@ +# +# Copyright (C) 2009 Sharim At Work, Ltd. +# Copyright (C) 2019 Jeffery To +# Author: Xiangfu Liu +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=byobu +PKG_VERSION:=5.127 +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_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Jeffery To + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/byobu/Default + SECTION:=utils + CATEGORY:=Utilities + URL:=http://byobu.org/ + PKGARCH:=all +endef + +define Package/byobu +$(call Package/byobu/Default) + TITLE:=Text-based window manager and terminal multiplexer + DEPENDS:=+python3-light +python3-newt +endef + +define Package/byobu-utils +$(call Package/byobu/Default) + TITLE:=Utilities included with byobu +endef + +define Package/byobu/description + Byobu is a GPLv3 open source text-based window manager and terminal + multiplexer. It was originally designed to provide elegant enhancements + to the otherwise functional, plain, practical GNU Screen, for the Ubuntu + server distribution. Byobu now includes an enhanced profiles, convenient + keybindings, configuration utilities, and toggle-able system status + notifications for both the GNU Screen window manager and the more modern + Tmux terminal multiplexer, and works on most Linux, BSD, and Mac + distributions. +endef + +define Package/byobu-utils/description +$(call Package/byobu/description) + + These are the "bikeshed" utilities bundled with byobu: + * col1..col9, NF + * ctail + * manifest + * purge-old-kernels + * vigpg + * wifi-status +endef + +define Package/byobu/install + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/* $(1)/etc/ + + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/byobu* $(1)/usr/bin/ + $(LN) byobu $(1)/usr/bin/byobu-screen + $(LN) byobu $(1)/usr/bin/byobu-tmux + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/byobu $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/usr/share/byobu + for i in keybindings profiles status windows; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/share/byobu/$$$$i $(1)/usr/share/byobu/ ; \ + done + + $(INSTALL_DIR) $(1)/usr/share/doc + $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/byobu $(1)/usr/share/doc/ +endef + +define Package/byobu-utils/install + $(INSTALL_DIR) $(1)/usr/bin + for i in col1 ctail manifest purge-old-kernels vigpg wifi-status; do \ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$$i $(1)/usr/bin/ ; \ + done + for i in col2 col3 col4 col5 col6 col7 col8 col9 NF; do \ + $(LN) col1 $(1)/usr/bin/$$$$i ; \ + done +endef + +$(eval $(call BuildPackage,byobu)) +$(eval $(call BuildPackage,byobu-utils)) diff --git a/utils/byobu/patches/001-hardcode-utf-8-charmap.patch b/utils/byobu/patches/001-hardcode-utf-8-charmap.patch new file mode 100644 index 000000000..e824ff055 --- /dev/null +++ b/utils/byobu/patches/001-hardcode-utf-8-charmap.patch @@ -0,0 +1,11 @@ +--- a/usr/bin/byobu.in ++++ b/usr/bin/byobu.in +@@ -46,7 +46,7 @@ if [ -z "${BYOBU_PREFIX}" ]; then + . "$HOME/.byoburc" + fi + fi +-export BYOBU_CHARMAP=$(locale charmap) ++export BYOBU_CHARMAP=UTF-8 + [ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc" + [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX + . "${BYOBU_PREFIX}/lib/${PKG}/include/common" diff --git a/utils/byobu/patches/002-fix-missing-tty-arm-serial-autolaunch.patch b/utils/byobu/patches/002-fix-missing-tty-arm-serial-autolaunch.patch new file mode 100644 index 000000000..a22777b7b --- /dev/null +++ b/utils/byobu/patches/002-fix-missing-tty-arm-serial-autolaunch.patch @@ -0,0 +1,24 @@ +--- 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 diff --git a/utils/byobu/patches/003-fix-missing-install.patch b/utils/byobu/patches/003-fix-missing-install.patch new file mode 100644 index 000000000..1af626f09 --- /dev/null +++ b/utils/byobu/patches/003-fix-missing-install.patch @@ -0,0 +1,11 @@ +--- 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 diff --git a/utils/byobu/patches/004-skip-python-test.patch b/utils/byobu/patches/004-skip-python-test.patch new file mode 100644 index 000000000..c18367622 --- /dev/null +++ b/utils/byobu/patches/004-skip-python-test.patch @@ -0,0 +1,10 @@ +--- a/usr/lib/byobu/include/constants ++++ b/usr/lib/byobu/include/constants +@@ -58,6 +58,7 @@ $BYOBU_SED --follow-symlinks "s///" /dev + eval $BYOBU_TEST ulimit >/dev/null 2>&1 && export BYOBU_ULIMIT="ulimit" || export BYOBU_ULIMIT="false" + + # Find a suitable python interpreter, if undefined ++export BYOBU_PYTHON="python3" + if [ -z "$BYOBU_PYTHON" ]; then + if python3 -c "import snack" >/dev/null 2>&1; then + export BYOBU_PYTHON="python3" diff --git a/utils/byobu/patches/005-monitor-overlay.patch b/utils/byobu/patches/005-monitor-overlay.patch new file mode 100644 index 000000000..fc4027a63 --- /dev/null +++ b/utils/byobu/patches/005-monitor-overlay.patch @@ -0,0 +1,28 @@ +--- a/usr/lib/byobu/disk ++++ b/usr/lib/byobu/disk +@@ -26,7 +26,10 @@ __disk_detail() { + __disk() { + local out="" MP="" size="" pct="" unit="" + # Default to /, but let users override +- [ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK" ++ MP="$MONITORED_DISK" ++ [ -n "$MP" ] || { ++ grep -q ' /overlay ' /proc/mounts && MP=/overlay || MP=/ ++ } + case $MP in + /dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /proc/mounts);; + esac +--- a/usr/lib/byobu/disk_io ++++ b/usr/lib/byobu/disk_io +@@ -42,7 +42,10 @@ getdisk() { + __disk_io() { + local part= i= + # Default to disk providing /, but let users override with MONITORED_DISK +- [ -z "$MONITORED_DISK" ] && mount_point="/" || mount_point="$MONITORED_DISK" ++ local mount_point="$MONITORED_DISK" ++ [ -n "$mount_point" ] || { ++ grep -q ' /overlay ' /proc/mounts && mount_point=/overlay || mount_point=/ ++ } + # 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 diff --git a/utils/byobu/patches/006-pgrep-services.patch b/utils/byobu/patches/006-pgrep-services.patch new file mode 100644 index 000000000..762a1cb00 --- /dev/null +++ b/utils/byobu/patches/006-pgrep-services.patch @@ -0,0 +1,13 @@ +--- 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*) diff --git a/utils/byobu/patches/007-count-dropbear-users.patch b/utils/byobu/patches/007-count-dropbear-users.patch new file mode 100644 index 000000000..3d3ccb3bd --- /dev/null +++ b/utils/byobu/patches/007-count-dropbear-users.patch @@ -0,0 +1,33 @@ +--- a/usr/lib/byobu/users ++++ b/usr/lib/byobu/users +@@ -22,20 +22,26 @@ + # along with this program. If not, see . + + __users_detail() { +- ps -ef | grep "sshd:.*@" | grep -v grep ++ ps -ef 2>/dev/null | grep "sshd:.*@" | grep -v grep + } + + __users() { +- local count=0 ++ local count=0 f pid ++ for f in /var/run/dropbear.*.pid; do ++ read pid < "$f" ++ count=$(($count + $(pgrep -P "$pid" | wc -l))) ++ done ++ if [ $count -eq 0 ]; then + 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 + # 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 + 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 -- + else + rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"* + fi diff --git a/utils/byobu/patches/008-no-gettext.patch b/utils/byobu/patches/008-no-gettext.patch new file mode 100644 index 000000000..981eb6793 --- /dev/null +++ b/utils/byobu/patches/008-no-gettext.patch @@ -0,0 +1,22 @@ +--- 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 ">" + } + diff --git a/utils/byobu/patches/100-check-if-bashrc-exists.patch b/utils/byobu/patches/100-check-if-bashrc-exists.patch new file mode 100644 index 000000000..79906d41a --- /dev/null +++ b/utils/byobu/patches/100-check-if-bashrc-exists.patch @@ -0,0 +1,29 @@ +--- 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 . + ++[ -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 diff --git a/utils/byobu/patches/101-fix-tmux-2.8-new-window.patch b/utils/byobu/patches/101-fix-tmux-2.8-new-window.patch new file mode 100644 index 000000000..511f20e98 --- /dev/null +++ b/utils/byobu/patches/101-fix-tmux-2.8-new-window.patch @@ -0,0 +1,34 @@ +--- 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 diff --git a/utils/byobu/patches/102-ensure-disk-exists.patch b/utils/byobu/patches/102-ensure-disk-exists.patch new file mode 100644 index 000000000..020a6ab19 --- /dev/null +++ b/utils/byobu/patches/102-ensure-disk-exists.patch @@ -0,0 +1,10 @@ +--- 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= diff --git a/utils/byobu/patches/103-add-hostname-fallback.patch b/utils/byobu/patches/103-add-hostname-fallback.patch new file mode 100644 index 000000000..c17ab14f7 --- /dev/null +++ b/utils/byobu/patches/103-add-hostname-fallback.patch @@ -0,0 +1,21 @@ +--- a/usr/lib/byobu/hostname ++++ b/usr/lib/byobu/hostname +@@ -20,12 +20,16 @@ + # along with this program. If not, see . + + __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 diff --git a/utils/byobu/patches/104-add-custom-logo.patch b/utils/byobu/patches/104-add-custom-logo.patch new file mode 100644 index 000000000..61400f0d3 --- /dev/null +++ b/utils/byobu/patches/104-add-custom-logo.patch @@ -0,0 +1,13 @@ +--- 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" diff --git a/utils/byobu/patches/105-handle-processes-stderr.patch b/utils/byobu/patches/105-handle-processes-stderr.patch new file mode 100644 index 000000000..e83ecda98 --- /dev/null +++ b/utils/byobu/patches/105-handle-processes-stderr.patch @@ -0,0 +1,21 @@ +--- a/usr/lib/byobu/processes ++++ b/usr/lib/byobu/processes +@@ -20,15 +20,15 @@ + # along with this program. If not, see . + + __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 -- diff --git a/utils/byobu/patches/106-fix-release-typo.patch b/utils/byobu/patches/106-fix-release-typo.patch new file mode 100644 index 000000000..d4d5bc4fa --- /dev/null +++ b/utils/byobu/patches/106-fix-release-typo.patch @@ -0,0 +1,11 @@ +--- 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 diff --git a/utils/byobu/patches/107-fix-SERVICES.patch b/utils/byobu/patches/107-fix-SERVICES.patch new file mode 100644 index 000000000..5533566df --- /dev/null +++ b/utils/byobu/patches/107-fix-SERVICES.patch @@ -0,0 +1,11 @@ +--- 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 diff --git a/utils/byobu/patches/108-custom-updates-available.patch b/utils/byobu/patches/108-custom-updates-available.patch new file mode 100644 index 000000000..1bdee5872 --- /dev/null +++ b/utils/byobu/patches/108-custom-updates-available.patch @@ -0,0 +1,39 @@ +--- 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 diff --git a/utils/byobu/patches/109-add-whoami-fallback.patch b/utils/byobu/patches/109-add-whoami-fallback.patch new file mode 100644 index 000000000..57d4263e0 --- /dev/null +++ b/utils/byobu/patches/109-add-whoami-fallback.patch @@ -0,0 +1,33 @@ +--- 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 . + ++___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 diff --git a/utils/byobu/patches/110-wifi-quality.patch b/utils/byobu/patches/110-wifi-quality.patch new file mode 100644 index 000000000..b814ab889 --- /dev/null +++ b/utils/byobu/patches/110-wifi-quality.patch @@ -0,0 +1,82 @@ +--- 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 . + ++___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 diff --git a/utils/byobu/patches/111-ensure-proc-mdstat-exists.patch b/utils/byobu/patches/111-ensure-proc-mdstat-exists.patch new file mode 100644 index 000000000..b190561fd --- /dev/null +++ b/utils/byobu/patches/111-ensure-proc-mdstat-exists.patch @@ -0,0 +1,10 @@ +--- 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 diff --git a/utils/byobu/patches/112-fix-session-regex.patch b/utils/byobu/patches/112-fix-session-regex.patch new file mode 100644 index 000000000..3890d3090 --- /dev/null +++ b/utils/byobu/patches/112-fix-session-regex.patch @@ -0,0 +1,11 @@ +--- 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