* usr/lib/byobu/include/shutil: LP: #930656

- support network interface detection on Mac OSX
  - untested by me, but sort of suggested by a user
This commit is contained in:
Dustin Kirkland 2012-02-21 21:55:33 -06:00
commit 53b480a657
2 changed files with 9 additions and 1 deletions

3
debian/changelog vendored
View file

@ -10,6 +10,9 @@ byobu (5.13) unreleased; urgency=low
usr/share/man/man1/byobu.1: LP: #929907 usr/share/man/man1/byobu.1: LP: #929907
- disable the ec2_cost plugin if not running in EC2, - disable the ec2_cost plugin if not running in EC2,
allow override with EC2_ESTIMATE=1 in ~/.byobu/statusrc 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 <kirkland@ubuntu.com> Thu, 16 Feb 2012 23:58:36 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Thu, 16 Feb 2012 23:58:36 -0600

View file

@ -292,13 +292,18 @@ get_now() {
get_network_interface() { get_network_interface() {
if [ -n "$MONITORED_NETWORK" ]; then if [ -n "$MONITORED_NETWORK" ]; then
# Manual override
_RET="$MONITORED_NETWORK" _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 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 while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
[ "$Mask" = "00000000" ] && break [ "$Mask" = "00000000" ] && break
done < /proc/net/route done < /proc/net/route
_RET="$Iface" _RET="$Iface"
else
# Mac OSX, shell out to the route command
_RET=$(/sbin/route get default|grep interface:|awk '{print $2}')
fi fi
} }