From 53b480a65734d4fbaf063ccae55e618cd8a41a1e Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 21 Feb 2012 21:55:33 -0600 Subject: [PATCH] * usr/lib/byobu/include/shutil: LP: #930656 - support network interface detection on Mac OSX - untested by me, but sort of suggested by a user --- debian/changelog | 3 +++ usr/lib/byobu/include/shutil | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index ada4c72d..f795a892 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,9 @@ byobu (5.13) unreleased; urgency=low usr/share/man/man1/byobu.1: LP: #929907 - disable the ec2_cost plugin if not running in EC2, allow override with EC2_ESTIMATE=1 in ~/.byobu/statusrc + * usr/lib/byobu/include/shutil: LP: #930656 + - support network interface detection on Mac OSX + - untested by me, but sort of suggested by a user -- Dustin Kirkland Thu, 16 Feb 2012 23:58:36 -0600 diff --git a/usr/lib/byobu/include/shutil b/usr/lib/byobu/include/shutil index 7d5b51e3..8a9639bf 100755 --- a/usr/lib/byobu/include/shutil +++ b/usr/lib/byobu/include/shutil @@ -292,13 +292,18 @@ get_now() { get_network_interface() { if [ -n "$MONITORED_NETWORK" ]; then + # Manual override _RET="$MONITORED_NETWORK" - else + elif [ -d /proc ]; then + # Linux systems, read route and interface from procfs local Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do [ "$Mask" = "00000000" ] && break done < /proc/net/route _RET="$Iface" + else + # Mac OSX, shell out to the route command + _RET=$(/sbin/route get default|grep interface:|awk '{print $2}') fi }