bin/*: route and ifconfig are in /sbin, fully qualify

-Dustin Kirkland <kirkland@ubuntu.com>Thu, 16 Apr 2009 12:37:21 -0500
This commit is contained in:
Dustin Kirkland 2009-04-16 12:37:40 -05:00
commit b01eb70a12
5 changed files with 8 additions and 7 deletions

View file

@ -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 }'`

View file

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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

View file

@ -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

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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"`

3
debian/changelog vendored
View file

@ -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 <bernardj@gmail.com> ]
* debian/control: fix typo in screen-profiles-extras description
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 16 Apr 2009 12:27:13 -0500
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 16 Apr 2009 12:37:21 -0500
screen-profiles (1.44-0ubuntu1) jaunty; urgency=low