diff options
author | Bill Nottingham <notting@redhat.com> | 2005-05-10 19:06:55 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2005-05-10 19:06:55 +0000 |
commit | 20e2d4679678cf377362de4a62edc8a8e38cf361 (patch) | |
tree | 24dfe25a9857ab4ebfcd93365f4cdcfce9e5c4e2 | |
parent | d9d8e7bae98fde71da9198aec035a229bb572cf8 (diff) | |
download | initscripts-20e2d4679678cf377362de4a62edc8a8e38cf361.tar initscripts-20e2d4679678cf377362de4a62edc8a8e38cf361.tar.gz initscripts-20e2d4679678cf377362de4a62edc8a8e38cf361.tar.bz2 initscripts-20e2d4679678cf377362de4a62edc8a8e38cf361.tar.xz initscripts-20e2d4679678cf377362de4a62edc8a8e38cf361.zip |
backport fgrep fixesFC3-branch
-rwxr-xr-x | sysconfig/network-scripts/ifdown | 2 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 170b1504..c7857caf 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -61,7 +61,7 @@ check_device_down ${DEVICE} && [ "$BOOTPROTO" != "dhcp" -a "$BOOTPROTO" != "boot if [ -n "${HWADDR}" -a -z "${MACADDR}" ]; then FOUNDMACADDR=`get_hwaddr ${REALDEVICE}` if [ -n "${FOUNDMACADDR}" -a "${FOUNDMACADDR}" != "${HWADDR}" ]; then - NEWCONFIG=`LANG=C grep -il "^[[:space:]]*HWADDR=${HWADDR}" /etc/sysconfig/network-scripts/ifcfg-*` + NEWCONFIG=`get_config_by_hwaddr ${FOUNDMACADDR}` if [ -n "${NEWCONFIG}" -a "${NEWCONFIG##*/}" != "${CONFIG##*/}" ]; then exec /sbin/ifdown ${NEWCONFIG} else diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 414f6235..e17bd3b4 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -14,6 +14,11 @@ get_hwaddr () awk '{ print toupper($0) }' } +get_config_by_hwaddr () +{ + LANG=C grep -il "^[[:space:]]*HWADDR=${1}\([[:space:]]\+\|#\+\|$\)" /etc/sysconfig/network-scripts/ifcfg-* +} + need_config () { CONFIG="ifcfg-${1}" @@ -22,7 +27,7 @@ need_config () [ -f "${CONFIG}" ] && return local addr=`get_hwaddr ${1}` if [ -n "$addr" ]; then - local nconfig=`LANG=C grep -il "^[[:space:]]*HWADDR=$addr" /etc/sysconfig/network-scripts/ifcfg-*` + local nconfig=`get_config_by_hwaddr ${addr}` if [ -n "$nconfig" ] ; then CONFIG=$nconfig [ -f "${CONFIG}" ] && return @@ -156,7 +161,7 @@ rename_device() { /sbin/nameif "$1" "$2" || { local hw2=`get_hwaddr ${1}` - local nconfig=`LANG=C grep -il "^[[:space:]]*HWADDR=$hw2" /etc/sysconfig/network-scripts/ifcfg-*` + local nconfig=`get_config_by_hwaddr ${hw2}` local dev= if [ -n "$nconfig" ]; then dev=$(. $nconfig ; echo $DEVICE) |