aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-02-16 13:53:15 -0500
committerBill Nottingham <notting@redhat.com>2010-03-01 16:03:36 -0500
commit7f6964b636fb980e83c7b84c1b46c319d4dca780 (patch)
treec4444a630f4fd6b11b954b77963aa5f69417452e /sysconfig
parentd37a29944a09e2e129c3bae4a5d3ff690ea6eda1 (diff)
downloadinitscripts-7f6964b636fb980e83c7b84c1b46c319d4dca780.tar
initscripts-7f6964b636fb980e83c7b84c1b46c319d4dca780.tar.gz
initscripts-7f6964b636fb980e83c7b84c1b46c319d4dca780.tar.bz2
initscripts-7f6964b636fb980e83c7b84c1b46c319d4dca780.tar.xz
initscripts-7f6964b636fb980e83c7b84c1b46c319d4dca780.zip
Add get_config_by_device, adjust caller.
Diffstat (limited to 'sysconfig')
-rw-r--r--sysconfig/network-scripts/network-functions12
1 files changed, 9 insertions, 3 deletions
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