version 1.160, 2015/11/12 22:50:46 |
version 1.161, 2015/11/12 23:00:13 |
|
|
done </etc/hostname.$if |
done </etc/hostname.$if |
} |
} |
|
|
# Start multiple: |
# Start multiple interfaces by driver name. |
# Usage: ifmstart "if1 if2" "if3 if4" |
# Usage: ifmstart "em iwm" "trunk vlan" |
# Start "$1" interfaces in order or all interfaces if empty. |
# Start "$1" interfaces in order or all interfaces if empty. |
# Don't start "$2" interfaces. |
# Don't start "$2" interfaces. "$2" is optional. |
ifmstart() { |
ifmstart() { |
for sif in ${1:-ALL}; do |
local _sifs=$1 _xifs=$2 _hn _if _sif _xif |
for hn in /etc/hostname.*; do |
|
# Strip off /etc/hostname. prefix. |
|
if=${hn#/etc/hostname.} |
|
[ "$if" = "*" ] && continue |
|
|
|
|
for _sif in ${_sifs:-ALL}; do |
|
for _hn in /etc/hostname.*; do |
|
_if=${_hn#/etc/hostname.} |
|
[[ $_if == '*' ]] && continue |
|
|
# Skip unwanted ifs. |
# Skip unwanted ifs. |
s="" |
for _xif in $_xifs; do |
for xf in $2; do |
[[ $_xif == ${_if%%[0-9]*} ]] && continue 2 |
[ "$xf" = "${if%%[0-9]*}" ] && s="1" && break |
|
done |
done |
[ "$s" = "1" ] && continue |
|
|
|
# Start wanted ifs. |
# Start wanted ifs. |
[ "$sif" = "ALL" -o "$sif" = "${if%%[0-9]*}" ] && |
[[ $_sif == @(ALL|${_if%%[0-9]*}) ]] && ifstart $_if |
ifstart $if |
|
done |
done |
done |
done |
} |
} |