From 7f6964b636fb980e83c7b84c1b46c319d4dca780 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 16 Feb 2010 13:53:15 -0500 Subject: Add get_config_by_device, adjust caller. --- sysconfig/network-scripts/network-functions | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sysconfig/network-scripts') diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 89baeb45..bef3606c 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,9 +63,7 @@ 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") + nconfig=$(get_config_by_device ${1}) if [ -n "$nconfig" ] && [ -f "$nconfig" ]; then CONFIG=${nconfig##*/} return -- cgit v1.2.1