From b01eb70a12ad51753c761db6b0c2f24a541f1ee4 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 16 Apr 2009 12:37:40 -0500 Subject: [PATCH] bin/*: route and ifconfig are in /sbin, fully qualify -Dustin Kirkland Thu, 16 Apr 2009 12:37:21 -0500 --- bin/ec2-cost | 2 +- bin/network-down | 4 ++-- bin/network-up | 4 ++-- bin/wifi-quality | 2 +- debian/changelog | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/ec2-cost b/bin/ec2-cost index bd02a4d1..5980f288 100755 --- a/bin/ec2-cost +++ b/bin/ec2-cost @@ -63,7 +63,7 @@ RX_RATE="0.10" TX_RATE="0.17" # Auto detect network interface -IF=`route -n | grep "0\.0\.0\.0" | tail -n1 | awk '{print $8}'` +IF=`/sbin/route -n | grep "0\.0\.0\.0" | tail -n1 | awk '{print $8}'` # Calculate bandwidth cost tx_gb=`/sbin/ifconfig "$IF" | grep "TX bytes:" | sed "s/^.*TX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'` diff --git a/bin/network-down b/bin/network-down index ac2ea77b..1d5f2847 100755 --- a/bin/network-down +++ b/bin/network-down @@ -18,7 +18,7 @@ # along with this program. If not, see . cache="$HOME/.screen-profiles/network-down" -interface=`route -n | tail -n 1 | sed "s/^.* //"` +interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"` unit="kB/s" t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0 @@ -28,7 +28,7 @@ if [ $t2 -le $t1 ]; then rate=0 else x1=`cat "$cache"` 2>/dev/null || tx1=0 - x2=`ifconfig "$interface" | grep "RX bytes" | sed "s/^.*RX bytes://" | sed "s/ .*$//"` + x2=`/sbin/ifconfig "$interface" | grep "RX bytes" | sed "s/^.*RX bytes://" | sed "s/ .*$//"` echo "$x2" > "$cache" rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'` if [ "$rate" -gt 1024 ]; then diff --git a/bin/network-up b/bin/network-up index ba9baec5..a27dc9e9 100755 --- a/bin/network-up +++ b/bin/network-up @@ -19,7 +19,7 @@ cache="$HOME/.screen-profiles/network-up" -interface=`route -n | tail -n 1 | sed "s/^.* //"` +interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"` unit="kB/s" t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0 @@ -29,7 +29,7 @@ if [ $t2 -le $t1 ]; then rate=0 else x1=`cat "$cache"` 2>/dev/null || tx1=0 - x2=`ifconfig "$interface" | grep "TX bytes" | sed "s/^.*TX bytes://" | sed "s/ .*$//"` + x2=`/sbin/ifconfig "$interface" | grep "TX bytes" | sed "s/^.*TX bytes://" | sed "s/ .*$//"` echo "$x2" > "$cache" rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'` if [ "$rate" -gt 1024 ]; then diff --git a/bin/wifi-quality b/bin/wifi-quality index 284b748e..31a11463 100755 --- a/bin/wifi-quality +++ b/bin/wifi-quality @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -interface=`route -n | tail -n 1 | sed "s/^.* //"` +interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"` bitrate=`iwconfig "$interface" 2>/dev/null | grep "Bit Rate." | sed "s/^.*Bit Rate.//" | sed "s/ .*$//g"` [ -z "$bitrate" ] && bitrate="0" quality=`iwconfig "$interface" 2>/dev/null | grep "Link Quality=" | sed "s/^.*Link Quality=//" | sed "s/ .*$//g"` diff --git a/debian/changelog b/debian/changelog index 4cc6602f..c1bef218 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,11 +5,12 @@ screen-profiles (1.45) unreleased; urgency=low * bin/uptime: don't print seconds, since we don't update often enough * screen-profiles-status: use home bin scripts, if available first, then fallback to system-wide, allows for local overrides + * bin/*: route and ifconfig are in /sbin, fully qualify [ Jon Bernard ] * debian/control: fix typo in screen-profiles-extras description - -- Dustin Kirkland Thu, 16 Apr 2009 12:27:13 -0500 + -- Dustin Kirkland Thu, 16 Apr 2009 12:37:21 -0500 screen-profiles (1.44-0ubuntu1) jaunty; urgency=low