Signed-off-by: Jeffery To <jeffery.to@gmail.com>lilik-openwrt-22.03
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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*) |
@ -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 ">" | |||
} | |||
@ -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 |
@ -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 |
@ -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= |
@ -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 |
@ -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" |
@ -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 -- |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |