From 5779d345b4b7ce7009429c7ce721ddc15413435d Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sun, 15 Jan 2012 11:15:23 -0600 Subject: [PATCH] * usr/bin/byobu-status, usr/share/man/man1/byobu.1: LP: #898065 - support ip_address4 and ip_address6 in the status line - allows for users to see both ipv4 and ipv6 addresses simultaneously rather than one or the other --- debian/changelog | 4 ++++ usr/bin/byobu-status | 19 ++++++++++++++++--- usr/share/man/man1/byobu.1 | 4 ++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index c9fb11bf..4b368417 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,10 @@ byobu (5.3) unreleased; urgency=low - fix regression from r1839, add colon to IFS * usr/share/man/man1/byobu.1: LP: #913817 - mention byobu-select-backend prominently in the manpage + * usr/bin/byobu-status, usr/share/man/man1/byobu.1: LP: #898065 + - support ip_address4 and ip_address6 in the status line + - allows for users to see both ipv4 and ipv6 addresses simultaneously + rather than one or the other [ Dustin Kirkland and Ryan Thompson ] * usr/bin/byobu-reconnect-sockets, usr/bin/byobu-select-session: LP: #908944 diff --git a/usr/bin/byobu-status b/usr/bin/byobu-status index fecd6769..e178daf7 100755 --- a/usr/bin/byobu-status +++ b/usr/bin/byobu-status @@ -50,12 +50,25 @@ get_status() { local lastpath="$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND/$1" local lastrun [ -r "$lastpath" ] && read lastrun < "$lastpath" || lastrun=0 - status_freq "$1" + case "$1" in + ip_address4) + IPV6=0 + function="ip_address" + ;; + ip_address6) + IPV6=1 + function="ip_address" + ;; + *) + function="$1" + ;; + esac + status_freq "$function" local expiry=$(($lastrun+$_RET)) - find_script "$1" && . "${_RET}" + find_script "$function" && . "${_RET}" # Update cache now, if necessary if [ $NOW -ge $expiry ] || [ "$lastrun" = "0" ]; then - "__$1" > "$cachepath" + "__$function" > "$cachepath" echo "$NOW" > "$lastpath" fi if [ -s "$cachepath" ]; then diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 60103dee..41ad472b 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -61,6 +61,10 @@ Note that BYOBU_CONFIG_DIR=\fI$XDG_CONFIG_HOME/byobu\fP if defined, and \fI$HOME \fBip_address\fP \- the IPv4 address of the system in dotted decimal form; displayed in the upper bar on the far right in bold black text on a grey background; you can override and display your IPv6 address by setting 'IPV6=1', and you can show your external ip address by setting 'IP_EXTERNAL=1' in \fI$BYOBU_CONFIG_DIR/statusrc\fP +\fBip_address4\fP \- the IPv4 address of the system in dotted decimal form; displayed in the upper bar on the far right in bold black text on a grey background; you can show your external ip address by setting 'IP_EXTERNAL=1' in \fI$BYOBU_CONFIG_DIR/statusrc\fP + +\fBip_address6\fP \- the IPv6 address of the system; displayed in the upper bar on the far right in bold black text on a grey background; you can show your external ip address by setting 'IP_EXTERNAL=1' in \fI$BYOBU_CONFIG_DIR/statusrc\fP + \fBload_average\fP \- the system load average over the last 1 minute; displayed in the lower bar toward the right in black text on a yellow background \fBlogo\fP \- an approximation of the current operating system's logo; displayed in the lower bar on the far left; you may customize this logo by setting a chosen logo in \fI$BYOBU_CONFIG_DIR/logo\fP, or you may override this with LOGO=:-D in \fI$BYOBU_CONFIG_DIR/statusrc\fP