diff --git a/debian/changelog b/debian/changelog index d4098ae7..fa565cb3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,10 @@ byobu (5.20) unreleased; urgency=low - create new BYOBU_TEST global, which is one of: [command -v, type, which] - command -v doesn't exist in busybox, type does + * usr/lib/byobu/ec2_cost, usr/lib/byobu/include/shutil, + usr/lib/byobu/rcs_cost: LP: #1013220 + - gracefully silence status notifications that require /proc/net/route + when it's not really there (cygwin, mac) -- Dustin Kirkland Fri, 08 Jun 2012 17:25:23 -0500 diff --git a/usr/lib/byobu/ec2_cost b/usr/lib/byobu/ec2_cost index d511eb7f..8387fe58 100755 --- a/usr/lib/byobu/ec2_cost +++ b/usr/lib/byobu/ec2_cost @@ -75,7 +75,8 @@ __ec2_cost() { fi hours=$(((`date +%s` - `stat --printf %Y $file_to_stat`) / 60 / 60 + 1)) # Auto detect network interface - interface=`tail -n1 /proc/net/route | awk '{print $1}'` + [ -r "/proc/net/route" ] || return + interface=$(tail -n1 /proc/net/route | awk '{print $1}') local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do case "$iface" in diff --git a/usr/lib/byobu/include/shutil b/usr/lib/byobu/include/shutil index 8a9639bf..b82cf860 100755 --- a/usr/lib/byobu/include/shutil +++ b/usr/lib/byobu/include/shutil @@ -294,14 +294,17 @@ get_network_interface() { if [ -n "$MONITORED_NETWORK" ]; then # Manual override _RET="$MONITORED_NETWORK" - elif [ -d /proc ]; then + elif [ -e /proc/net/route ]; 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 + elif $BYOBU_TEST route >/dev/null; then + # Route command on path + _RET=$(route get default|grep interface:|awk '{print $2}') + elif [ -x "/sbin/route" ]; then # Mac OSX, shell out to the route command _RET=$(/sbin/route get default|grep interface:|awk '{print $2}') fi diff --git a/usr/lib/byobu/rcs_cost b/usr/lib/byobu/rcs_cost index bc7d2ada..009cfa5f 100755 --- a/usr/lib/byobu/rcs_cost +++ b/usr/lib/byobu/rcs_cost @@ -59,7 +59,8 @@ __rcs_cost() { TX_RATE="0.22" # Auto detect network interface - IF=`tail -n1 /proc/net/route | awk '{print $1}'` + [ -r "/proc/net/route" ] || return + IF=$(tail -n1 /proc/net/route | awk '{print $1}') ifconfig_out=`LC_ALL=C /sbin/ifconfig "$IF"`