diff --git a/debian/changelog b/debian/changelog index bb154d07..686b9116 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ byobu (4.43) unreleased; urgency=low - * UNRELEASED + * usr/bin/byobu, usr/lib/byobu/ip_address, usr/share/man/man1/byobu.1: + - support IP_EXTERNAL fetching, LP: #873736 + - put ip address in the terminal title bar, since we ran out of room + for it in tmux -- Dustin Kirkland Fri, 21 Oct 2011 13:43:57 -0500 diff --git a/usr/bin/byobu b/usr/bin/byobu index 488afede..3eb00055 100755 --- a/usr/bin/byobu +++ b/usr/bin/byobu @@ -63,7 +63,9 @@ fi byobu-janitor --force # Set the window title -[ -n "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@${HOSTNAME:-$(hostname)} - ${PKG}\007" +[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc" +. $BYOBU_PREFIX/lib/$PKG/ip_address +[ -n "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@${HOSTNAME:-$(hostname)} ($(__ip_address t)) - ${PKG}\007" # Drop a symlink to the ssh socket in $HOME, since we can ensure that exists if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then diff --git a/usr/lib/byobu/ip_address b/usr/lib/byobu/ip_address index e026f722..864b42f5 100755 --- a/usr/lib/byobu/ip_address +++ b/usr/lib/byobu/ip_address @@ -38,14 +38,20 @@ __ip_address() { fi case "$IPV6" in 1|true|yes) - ipaddr=$(LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global) - # Print 'None' if we have no global address - [ -z "$ipaddr" ] && ipaddr="None" - ipaddr=${ipaddr#* inet6 } - ipaddr=${ipaddr%%/*} + if [ "$IP_EXTERNAL" = "1" ]; then + ipaddr=$(wget -O- -q http://v6.ipv6-test.com/api/myip.php) + else + ipaddr=$(LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global) + # Print 'None' if we have no global address + [ -z "$ipaddr" ] && ipaddr="None" + ipaddr=${ipaddr#* inet6 } + ipaddr=${ipaddr%%/*} + fi ;; *) - if metadata_available; then + if [ "$IP_EXTERNAL" = "1" ]; then + ipaddr=$(wget -O- -q http://v4.ipv6-test.com/api/myip.php) + elif metadata_available; then # We're in EC2, so get our public IP address ipaddr=$(wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4) else @@ -56,7 +62,11 @@ __ip_address() { ;; esac if [ -n "$ipaddr" ]; then - color bold2; printf "%s" "$ipaddr"; color -- + if [ "$1" = "t" ]; then + printf "%s" "$ipaddr" + else + color bold2; printf "%s" "$ipaddr"; color -- + fi fi } diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 609912c2..41010b5f 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -51,7 +51,7 @@ Note that BYOBU_CONFIG_DIR=\fI$XDG_CONFIG_HOME/byobu\fP if defined, and \fI$HOME \fBhostname\fP \- the hostname of the system; displayed in the upper bar on the far right in bold black text on a grey background; there is a leading '@' symbol if the username status is also enabled -\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' in \fI$BYOBU_CONFIG_DIR/statusrc\fP +\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 \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