forked from openzfsonosx/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.sh
executable file
·58 lines (49 loc) · 1.26 KB
/
cmd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
if test x"$#" = "x0" ; then
printf "You need to supply a command.\n"
exit 1
fi
cmd=$1
shift
READLINK=`which greadlink 2>/dev/null`
if test x$READLINK = "x" ; then
READLINK=`which readlink 2>/dev/null`
fi
if ! test x$READLINK = "x" ; then
$READLINK -f . > /dev/null 2>&1
if ! test x$? = "x0" ; then
unset READLINK
else
CANONICALIZE="$READLINK -f"
fi
fi
if test x$READLINK = "x" ; then
REALPATH=`which grealpath 2>/dev/null`
if test x$REALPATH = "x" ; then
REALPATH=`which realpath 2>/dev/null`
fi
if test x$REALPATH = "x" ; then
CANONICALIZE=readlink
else
CANONICALIZE=$REALPATH
fi
fi
topdir=`dirname "$($CANONICALIZE "$0")"`
if test x$topdir = x"." ; then
if ! test -f zfs.release.in ; then
printf "cd into the zfs source directory or install GNU readlink or realpath.\n"
printf "Homebrew: brew install coreutils\n"
printf "MacPorts: port install coreutils\n"
printf "Gentoo Prefix: emerge sys-apps/coreutils\n"
exit 1
fi
fi
for lib in nvpair uutil zpool zfs zfs_core; do
export DYLD_LIBRARY_PATH=$topdir/lib/lib${lib}/.libs:$DYLD_LIBRARY_PATH
done
for c in zdb zfs zpool ztest; do
export PATH=${topdir}/cmd/${c}/.libs:$PATH
done
#echo PATH=$PATH
#echo DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
exec ${topdir}/cmd/$cmd/.libs/$cmd "$@"