From c402e60e2b2af0f4f1cdd7129dcceb678e2b3f09 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Wed, 24 Feb 2016 16:57:11 -0500 Subject: [PATCH] LINUX: ifconfig is deprecated ifconfig is deprecated and is no longer installed by default on RHEL 7 and Centos 7. Use the replacement ip command in the init script for linux. Fallback to ifconfig in the event the ip command is not available. Thanks to Ben Kaduk for pointing out the hash built-in command. Reviewed-on: http://gerrit.openafs.org/12192 Tested-by: BuildBot Reviewed-by: Chas Williams <3chas3@gmail.com> Reviewed-by: Benjamin Kaduk (cherry picked from commit b702ab5da216976ed01ad3b1c474ecd4cc522ff2) Change-Id: I9ffdfee233555f1e06bc4f980e2905851224ecc9 Reviewed-on: https://gerrit.openafs.org/12193 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand --- src/afsd/afs.rc.linux | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/afsd/afs.rc.linux b/src/afsd/afs.rc.linux index 4df45a11d..288baabca 100644 --- a/src/afsd/afs.rc.linux +++ b/src/afsd/afs.rc.linux @@ -82,7 +82,15 @@ is_on() { } on_network() { - ADDRS=`LANG=C ifconfig -a | grep 'inet ' | grep -v 127.0.0.1 | wc -l` + if hash ip 2>/dev/null >/dev/null; then + IP="ip -4 addr" + elif hash ifconfg 2>/dev/null >/dev/null; then + IP="ifconfig -a" + else + echo afs: Unable to check interfaces. 1>&2 + return 1 + fi + ADDRS=`LANG=C ${IP} | grep 'inet ' | grep -v 127.0.0.1 | wc -l` if [ "$ADDRS" = "" ]; then echo afs: No interfaces with IP address 1>&2 return 1 -- 2.39.5