* lib/byobu/ip_address, share/man/man1/byobu.1:

- display both ifconfig and ip output in ip_address detail display
  - use ip rather than ifconfig to get the ip address, slight performance
    improvement
  - support a flag, IPV6=1, in .byobu/status, to allow for showing
    IPv6 addresses instead of IPv4
  - thanks to Mark Schouten <mark@prevented.net> for the IPv6 idea and
    sample code
This commit is contained in:
Dustin Kirkland 2010-09-01 10:59:46 -06:00
commit 54f087651a
3 changed files with 30 additions and 6 deletions

8
debian/changelog vendored
View file

@ -5,6 +5,14 @@ byobu (3.4) unreleased; urgency=low
gnome-terminal
* bin/byobu-janitor, share/byobu/keybindings/f-keys: use sed -e, for
Mac OS X compatibility, LP: #625387
* lib/byobu/ip_address, share/man/man1/byobu.1:
- display both ifconfig and ip output in ip_address detail display
- use ip rather than ifconfig to get the ip address, slight performance
improvement
- support a flag, IPV6=1, in .byobu/status, to allow for showing
IPv6 addresses instead of IPv4
- thanks to Mark Schouten <mark@prevented.net> for the IPv6 idea and
sample code
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 24 Aug 2010 18:21:14 -0400

View file

@ -21,7 +21,9 @@ PKG="byobu"
color 2>/dev/null || color() { true; }
if [ "$1" = "--detail" ]; then
/sbin/ifconfig
[ -x /sbin/ifconfig ] && /sbin/ifconfig
/sbin/ip -4 addr list
/sbin/ip -6 addr list
exit 0
fi
@ -33,11 +35,25 @@ fi
if [ -n "$MONITORED_NETWORK" ]; then
interface="$MONITORED_NETWORK"
else
interface=`tail -n1 /proc/net/route | awk '{print $1}'`
case "$IPV6" in
1|true|yes) interface=$(grep -v "\Wlo$" /proc/net/ipv6_route | tail -n1 | awk '{print $10}') ;;
*) interface=$(tail -n1 /proc/net/route | awk '{print $1}') ;;
esac
fi
ipaddr=$(LC_ALL=C /sbin/ifconfig "$interface")
ipaddr=${ipaddr#* inet addr:}
ipaddr=${ipaddr%% *}
case "$IPV6" in
1|true|yes)
ipaddr=$(LC_ALL=C /sbin/ip -6 addr list dev "$interface")
# Print 'None' if we have no global address
[ -z "$ipaddr" ] && ipaddr="None"
ipaddr=${ipaddr#* inet6 }
ipaddr=${ipaddr%%/*}
;;
*)
ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface")
ipaddr=${ipaddr#* inet }
ipaddr=${ipaddr%%/*}
;;
esac
printf "%s$(color bold2)%s$(color -)" "$space" "$ipaddr"

View file

@ -42,7 +42,7 @@ byobu \- wrapper script for seeding a user's byobu configuration and launching s
\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 ip 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
\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$HOME/.byobu/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