improve iface_up and iface_down functions

This commit is contained in:
Stanislav Ievlev 2009-04-13 13:05:09 +04:00
parent 3409cb5833
commit dfcc05897e

View File

@ -231,10 +231,26 @@ list_network()
iface_up()
{
env -i PATH="$PATH" HOME="$HOME" TMPDIR="$TMPDIR" /sbin/ifup "$1" >/dev/null
local iface="$1";shift
local n="${1:-0}";shift
env -i PATH="$PATH" HOME="$HOME" TMPDIR="$TMPDIR" /sbin/ifup "$iface" >/dev/null
for i in $(seq 0 "$n"); do
netdev_is_up "$iface" && return 0
[ "$i" != "$n" ] || sleep 1
done
return 1
}
iface_down()
{
env -i PATH="$PATH" HOME="$HOME" TMPDIR="$TMPDIR" /sbin/ifdown "$1" >/dev/null
local iface="$1";shift
local n="${1:-0}";shift
env -i PATH="$PATH" HOME="$HOME" TMPDIR="$TMPDIR" /sbin/ifdown "$iface" >/dev/null
for i in $(seq 0 "$n"); do
netdev_is_up "$iface" || return 0
[ "$i" != "$n" ] || sleep 1
done
return 1
}