We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 00d0431 + cba5e6a commit a3a6b06Copy full SHA for a3a6b06
test
@@ -11,7 +11,28 @@
11
#
12
set -e
13
14
-BASEDIR=$(readlink -f $(dirname $0))
+# Cross compatibility with osx
15
+# origin source: https://github.com/kubernetes/kubernetes/blob/master/hack/lib/init.sh#L102
16
+function readlinkdashf() {
17
+ # run in a subshell for simpler 'cd'
18
+ (
19
+ if [[ -d "$1" ]]; then # This also catch symlinks to dirs.
20
+ cd "$1"
21
+ pwd -P
22
+ else
23
+ cd $(dirname "$1")
24
+ local f
25
+ f=$(basename "$1")
26
+ if [[ -L "$f" ]]; then
27
+ readlink "$f"
28
29
+ echo "$(pwd -P)/${f}"
30
+ fi
31
32
+ )
33
+}
34
+
35
+BASEDIR=$(readlinkdashf $(dirname $0))
36
BINDIR=${BASEDIR}/bin
37
38
if [ $PWD != $BASEDIR ]; then
0 commit comments