diff options
author | Nicolas Lécureuil <neoclust@mageia.org> | 2016-02-12 18:41:10 +0100 |
---|---|---|
committer | Nicolas Lécureuil <neoclust@mageia.org> | 2016-02-12 18:41:10 +0100 |
commit | 346780b013c402167bfea577b392569e8d11511c (patch) | |
tree | 4959fab260535d7c5f8f4ce14c669834ec65902b /sysconfig/network-scripts/network-functions | |
parent | ba1c7819d747af0d935dd3878555324025cd772d (diff) | |
parent | cfbc1873f04b1fc6d2289f452380715f4c0a7bb0 (diff) | |
download | initscripts-346780b013c402167bfea577b392569e8d11511c.tar initscripts-346780b013c402167bfea577b392569e8d11511c.tar.gz initscripts-346780b013c402167bfea577b392569e8d11511c.tar.bz2 initscripts-346780b013c402167bfea577b392569e8d11511c.tar.xz initscripts-346780b013c402167bfea577b392569e8d11511c.zip |
Merge tag 'initscripts-9.60-1' into distro/mga
Tag as initscripts-9.60-1
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r-- | sysconfig/network-scripts/network-functions | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index ffc23238..9e269fda 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -466,7 +466,9 @@ add_default_route () is_wireless_device () { - [ -d "/sys/class/net/$1/wireless" -o -d "/sys/class/net/$1/phy80211" ] + [ -x /usr/sbin/iw ] || return 1 + LC_ALL=C /usr/sbin/iw dev $1 info > /dev/null 2>&1 || return 0 + return 1 } phy_wireless_device () @@ -474,10 +476,22 @@ phy_wireless_device () cat /sys/class/net/$1/phy80211/name } +bond_master_exists () +{ + local bond_name + [ -z "${1}" ] && return 1 + [ ! -f /sys/class/net/bonding_masters ] && return 1 + + for bond_name in $(< /sys/class/net/bonding_masters); do + [ "${bond_name}" == "${1}" ] && return 0 + done + return 1 +} + install_bonding_driver () { - [ ! -f /sys/class/net/bonding_masters ] && ( modprobe bonding || return 1 ) - if ! fgrep -sqx "$1" /sys/class/net/bonding_masters; then + if ! bond_master_exists ${1}; then + modprobe bonding || return 1 echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null fi ( |