Fix path lookup stuff once more
authorWouter Verhelst <w@uter.be>
Wed, 4 Apr 2018 12:31:54 +0000 (14:31 +0200)
committerWouter Verhelst <w@uter.be>
Wed, 4 Apr 2018 12:31:54 +0000 (14:31 +0200)
Sigh.

realpath is "portable", except not implemented on older versions of
coreutils, including the one in Ubuntu Trusty :-(

So, default to using realpath (which has the advantage of not requiring
options anywhere), and fall back to readlink -f if that doesn't exist in
our path.

If that also fails, then the test suite will fail, but have a nice
"readlink: -f: invalid option" or some such all over it, pointing to
what the likely culprit is.

tests/run/simple_test

index 4d057b4..777b91d 100755 (executable)
@@ -5,12 +5,19 @@ if [ -z "$TMPDIR" ]
 then
        TMPDIR=/tmp
 fi
+
+REALPATH=$(which realpath)
+if [ -z "$REALPATH" ]
+then
+       REALPATH="readlink -f"
+fi
+
 tmpdir=`mktemp -d $TMPDIR/tmp.XXXXXX`
 conffile=${tmpdir}/nbd.conf
 pidfile=${tmpdir}/nbd.pid
 tmpnam=${tmpdir}/nbd.dd
 mydir=$(dirname $0)
-certdir=$(realpath ${mydir}/certs)
+certdir=$($REALPATH ${mydir}/certs)
 cleanup="$2"
 PID=""