-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvarmyknife
executable file
·54 lines (36 loc) · 1.18 KB
/
varmyknife
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
#!/bin/bash
WHICH_JAVA=$( which java )
if [ "$WHICH_JAVA" == "" ]; then
(>&2 echo "error: java not found")
exit 1
fi
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
#if [ "$VARMYKNIFE_JAR" == "" ]; then
# (>&2 echo "error: VARMYKNIFE_JAR environment variable not found")
# exit 1
#fi
VARMYKNIFE_JAR=${DIR}/../vArmyKnife.jar
if [ ! -f "${VARMYKNIFE_JAR}" ]; then
VARMYKNIFE_JAR=${DIR}/vArmyKnife.jar
fi
if [ ! -f "${VARMYKNIFE_JAR}" ]; then
(>&2 echo "ERROR: CANNOT FIND VARMYKNIFE_JAR")
fi
(>&2 echo "JAVA=${WHICH_JAVA}")
(>&2 echo "JAR=${VARMYKNIFE_JAR}")
JAVAOPTS="";
while [ "${1:0:1}" == "-" ]; do
JAVAOPTS="$JAVAOPTS $1"
shift
done
#To echo to stderr:
#(>&2 echo "error")
(>&2 echo "JAVAOPTS=\"${JAVAOPTS}\"")
(>&2 echo "ANNOJAR_COMMAND=${1}...")
java $JAVAOPTS -jar $VARMYKNIFE_JAR "$@"