36 lines
1.2 KiB
Bash
36 lines
1.2 KiB
Bash
|
#!/bin/bash
|
||
|
# -*- mode: sh; tab-width: 8; encoding: utf-8-unix -*-
|
||
|
|
||
|
prog=$( basename $0 .bash )
|
||
|
. /usr/local/bin/usr_local_tput.bash || exit 2
|
||
|
PREFIX=/usr/local
|
||
|
ROLE=proxy
|
||
|
|
||
|
route | grep -q ^default || exit 0
|
||
|
|
||
|
[ -f $PREFIX/etc/testforge/testforge.bash ] && . /usr/local/etc/testforge/testforge.bash \
|
||
|
|| { echo >&2 ERROR: $prog "$PREFIX/etc/testforge/testforge.bash" ; exit 1 ; }
|
||
|
|
||
|
error () { retval=$1 ; shift; echo "ERROR: $prog" $* ; exit $retval ; }
|
||
|
warn () { WARN "$prog " $* ; }
|
||
|
info () { echo "INFO: $prog " $* ; }
|
||
|
usage () { echo "USAGE: $prog chroot-dir [command args] -" $* ; exit 1 ; }
|
||
|
|
||
|
# must be run as root
|
||
|
[ "$( id -u )" -ne "0" ] && error 1 "must be run as root"
|
||
|
|
||
|
PROXY_WLAN=$( /usr/local/bin/proxy_get_if.bash )
|
||
|
[ $? -eq 0 ] || error 2 " error getting device $?"
|
||
|
PROXY_WLAN_IP=$( proxy_ping_lib.bash proxy_get_wlan_ip )
|
||
|
|
||
|
LARGS="-i $PROXY_WLAN"
|
||
|
CONF=/usr/local/etc/jnettop.conf
|
||
|
if [ -f $CONF ] ; then
|
||
|
LARGS="$LARGS --config-file $CONF"
|
||
|
|
||
|
# sed -e 's/^#* *interface.*/interface "'$PROXY_WLAN'"/' -i $CONF
|
||
|
[ -n "$PROXY_WLAN_IP" ] && sed -e 's/"me"\t.*/"me" "net '$PROXY_WLAN_IP'"/' -i $CONF && grep -q $PROXY_WLAN_IP $CONF
|
||
|
fi
|
||
|
|
||
|
exec jnettop $LARGS $* # 2>/dev/null
|