forked from slamdev/bazel-js-showcase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseliskw
executable file
·65 lines (55 loc) · 1.2 KB
/
baseliskw
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
59
60
61
62
63
64
65
#!/usr/bin/env sh
##############################################################################
##
## Bazel start up script for UN*X (based on gradlew script from gradle wrapper project)
##
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="bazelisk"
APP_BASE_NAME=`basename "$0"`
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
## Determine OS.
darwin=false
linux=false
case "`uname`" in
Darwin* )
darwin=true
;;
Linux* )
linux=true
;;
esac
BINARY_PATH=""
if $darwin; then
BINARY_PATH=bazelisk-darwin-amd64
elif $linux; then
BINARY_PATH=bazelisk-linux-amd64
else
die "UNSUPPORTED OS! Command 'uname' says: `uname`. 'darwin' = $darwin and 'linux' = $linux"
fi
exec "$APP_HOME/bazelisk/$BINARY_PATH" "$@"