allow interface overrides for ip address

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-08-17 14:12:15 -05:00
commit bcd3b3f215

View file

@ -29,7 +29,13 @@ fi
[ "$hostname" = "1" ] && space=" "
[ "$whoami" = "1" ] && space=" "
interface=`tail -n1 /proc/net/route | awk '{print $1}'`
# Allow interface overrides in $HOME/.$PKG/statusrc
if [ -n "$MONITORED_NETWORK" ]; then
interface="$MONITORED_NETWORK"
else
interface=`tail -n1 /proc/net/route | awk '{print $1}'`
fi
ipaddr=`/sbin/ifconfig "$interface" | grep "inet addr:" | sed "s/^.*inet addr://" | sed "s/ .*$//"`
printf "%s\005{+b }%s\005{-}" "$space" "$ipaddr"