improve iface_up and iface_down functions
This commit is contained in:
parent
3409cb5833
commit
dfcc05897e
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user