aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions14
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