diff options
author | Bill Nottingham <notting@redhat.com> | 2010-02-16 13:53:15 -0500 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2010-04-09 16:35:22 -0400 |
commit | 6d6772dfa7fc001dc3c76995ffd6411b3abb08c5 (patch) | |
tree | 52b13656dc25083fe004a71dfa79e2f6561e202b /sysconfig | |
parent | d5d1ab095c78be58b8844646873aaec90adfd964 (diff) | |
download | initscripts-6d6772dfa7fc001dc3c76995ffd6411b3abb08c5.tar initscripts-6d6772dfa7fc001dc3c76995ffd6411b3abb08c5.tar.gz initscripts-6d6772dfa7fc001dc3c76995ffd6411b3abb08c5.tar.bz2 initscripts-6d6772dfa7fc001dc3c76995ffd6411b3abb08c5.tar.xz initscripts-6d6772dfa7fc001dc3c76995ffd6411b3abb08c5.zip |
Add get_config_by_device, adjust caller.
Diffstat (limited to 'sysconfig')
-rw-r--r-- | sysconfig/network-scripts/network-functions | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 1d1c43d2..b35f939d 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -20,6 +20,13 @@ get_hwaddr () fi } +get_config_by_device () +{ + LANG=C grep -l "^[[:space:]]*DEVICE=${1}\([[:space:]#]\|$\)" \ + /etc/sysconfig/network-scripts/ifcfg-* \ + | LC_ALL=C sed -e "$__sed_discard_ignored_files" +} + get_config_by_hwaddr () { LANG=C grep -il "^[[:space:]]*HWADDR=${1}\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-* \ @@ -34,6 +41,7 @@ get_config_by_subchannel () | LC_ALL=C sed -e "$__sed_discard_ignored_files" } + get_device_by_hwaddr () { LANG=C ip -o link | grep -v link/ieee802.11 | awk -F ': ' -vIGNORECASE=1 "/$1/ { print \$2 }" @@ -55,10 +63,8 @@ need_config () [ -f "${CONFIG}" ] && return fi fi - nconfig=$(LANG=C grep -l "^[[:space:]]*DEVICE=${1}\([[:space:]#]\|$\)" \ - /etc/sysconfig/network-scripts/ifcfg-* \ - | LC_ALL=C sed -e "$__sed_discard_ignored_files") - if [ -n "$nconfig" -a -f "$nconfig" ]; then + nconfig=$(get_config_by_device ${1}) + if [ -n "$nconfig" ] && [ -f "$nconfig" ]; then CONFIG=${nconfig##*/} return fi |