From efb6ec1b2fedc4a743868046da7efc48f5ec6b69 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 22 Oct 2019 14:35:15 +0200 Subject: [PATCH] testminiwget.sh: use either "ip addr" or "ifconfig -a" --- miniupnpc/testminiwget.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/miniupnpc/testminiwget.sh b/miniupnpc/testminiwget.sh index 32154e0..415e97b 100755 --- a/miniupnpc/testminiwget.sh +++ b/miniupnpc/testminiwget.sh @@ -2,7 +2,7 @@ # $Id: testminiwget.sh,v 1.15 2017/11/02 17:36:26 nanard Exp $ # vim: tabstop=4 shiftwidth=4 noexpandtab # project miniupnp : http://miniupnp.free.fr/ -# (c) 2011-2018 Thomas Bernard +# (c) 2011-2019 Thomas Bernard # # test program for miniwget.c # is usually invoked by "make check" @@ -23,12 +23,19 @@ DOWNLOADEDFILE="${TMPD}/downloadedfile" PORT= RET=0 IPCONFIG=$(which ifconfig) -if [ -z "$IPCONFIG" ] ; then - IPCONFIG="/sbin/ifconfig" -fi +IP=$(which ip) +if [ "$IP" ] ; then + if ! $IP addr | grep inet6 ; then + HAVE_IPV6=no + fi +else + if [ -z "$IPCONFIG" ] ; then + IPCONFIG="/sbin/ifconfig" + fi -if ! $IPCONFIG -a | grep inet6 ; then - HAVE_IPV6=no + if ! $IPCONFIG -a | grep inet6 ; then + HAVE_IPV6=no + fi fi case "$HAVE_IPV6" in