network: use 'command -v ip' to test for the ip executable

This is an improved test because it doesn't require the ip executable to be
in a specific path.
This commit is contained in:
William Hubbs 2017-12-12 14:23:04 -06:00
parent 9d05f68b51
commit 8bf501aaf2

View File

@ -76,7 +76,7 @@ tentative()
case "$RC_UNAME" in case "$RC_UNAME" in
Linux) Linux)
[ -x /sbin/ip ] || [ -x /bin/ip ] || return 1 [ -n "$(command -v ip)" ] || return 1
[ -n "$(ip -f inet6 addr show tentative)" ] [ -n "$(ip -f inet6 addr show tentative)" ]
;; ;;
*) *)
@ -174,7 +174,7 @@ runip()
routeflush() routeflush()
{ {
if [ "$RC_UNAME" = Linux ]; then if [ "$RC_UNAME" = Linux ]; then
if [ -x /sbin/ip ] || [ -x /bin/ip ]; then if [ -n "$(command -v ip)" ]; then
ip route flush scope global ip route flush scope global
ip route delete default 2>/dev/null ip route delete default 2>/dev/null
else else
@ -346,7 +346,7 @@ stop()
then then
veinfo "$int" veinfo "$int"
runargs /etc/ifdown."$int" "$downcmd" runargs /etc/ifdown."$int" "$downcmd"
if [ -x /sbin/ip ] || [ -x /bin/ip ]; then if [ -n "$(command -v ip)" ]; then
# We need to do this, otherwise we may # We need to do this, otherwise we may
# fail to add things correctly on restart # fail to add things correctly on restart
ip address flush dev "$int" 2>/dev/null ip address flush dev "$int" 2>/dev/null