mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* 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)
This commit is contained in:
parent
3083a9cd64
commit
7bb90abe4f
4 changed files with 13 additions and 4 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -27,6 +27,10 @@ byobu (5.20) unreleased; urgency=low
|
||||||
- create new BYOBU_TEST global, which is one of:
|
- create new BYOBU_TEST global, which is one of:
|
||||||
[command -v, type, which]
|
[command -v, type, which]
|
||||||
- command -v doesn't exist in busybox, type does
|
- 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 <kirkland@ubuntu.com> Fri, 08 Jun 2012 17:25:23 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 08 Jun 2012 17:25:23 -0500
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,8 @@ __ec2_cost() {
|
||||||
fi
|
fi
|
||||||
hours=$(((`date +%s` - `stat --printf %Y $file_to_stat`) / 60 / 60 + 1))
|
hours=$(((`date +%s` - `stat --printf %Y $file_to_stat`) / 60 / 60 + 1))
|
||||||
# Auto detect network interface
|
# 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
|
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
|
while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
|
||||||
case "$iface" in
|
case "$iface" in
|
||||||
|
|
|
@ -294,14 +294,17 @@ get_network_interface() {
|
||||||
if [ -n "$MONITORED_NETWORK" ]; then
|
if [ -n "$MONITORED_NETWORK" ]; then
|
||||||
# Manual override
|
# Manual override
|
||||||
_RET="$MONITORED_NETWORK"
|
_RET="$MONITORED_NETWORK"
|
||||||
elif [ -d /proc ]; then
|
elif [ -e /proc/net/route ]; then
|
||||||
# Linux systems, read route and interface from procfs
|
# 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
|
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
|
# Mac OSX, shell out to the route command
|
||||||
_RET=$(/sbin/route get default|grep interface:|awk '{print $2}')
|
_RET=$(/sbin/route get default|grep interface:|awk '{print $2}')
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -59,7 +59,8 @@ __rcs_cost() {
|
||||||
TX_RATE="0.22"
|
TX_RATE="0.22"
|
||||||
|
|
||||||
# Auto detect network interface
|
# 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"`
|
ifconfig_out=`LC_ALL=C /sbin/ifconfig "$IF"`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue