Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash fixes for Mac (10.12) compatibility #250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions OWLTools-Runner/bin/owltools.script
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#!/bin/bash
# Path to this script/jar
PATH_TO_SELF=`which $0`
MY_NAME=`basename $0`
MY_DIR=`dirname $0`

IS_MAC="FALSE"
if uname | grep -iq Darwin; then
IS_MAC="TRUE"
fi

if [ $IS_MAC = "TRUE" ]
then
# Path to this script/jar
PATH_TO_SELF=`which "$0"`
MY_NAME=`basename "$0"`
MY_DIR=`dirname "$0"`
else
# Path to this script/jar
PATH_TO_SELF=`which $0`
MY_NAME=`basename $0`
MY_DIR=`dirname $0`
fi

# Add possibly existing java args from $MY_NAME.vmoptions file or env var
if [ -e "$PATH_TO_SELF.vmoptions" ]
Expand All @@ -21,14 +35,24 @@ fi
JAVA=`which java`

# full command
CMD="$JAVA -Xms2G $JVM_OPTIONS -DentityExmpansionLimit=4086000 -Djava.awt.headless=true -classpath $PATH_TO_SELF owltools.cli.CommandLineInterface"
if [ $IS_MAC = "TRUE" ]
then
CMD="$JAVA -Xms2G $JVM_OPTIONS -DentityExmpansionLimit=4086000 -Djava.awt.headless=true -classpath \"$MY_DIR/owltools-oort-all.jar:$MY_DIR/owltools-runner-all.jar\" owltools.cli.CommandLineInterface"
else
CMD="$JAVA -Xms2G $JVM_OPTIONS -DentityExmpansionLimit=4086000 -Djava.awt.headless=true -classpath $PATH_TO_SELF owltools.cli.CommandLineInterface"
fi

if [ $DEBUG ]
then
echo $CMD "$@"
fi

# Run
exec "$JAVA" -Xms2G $JVM_OPTIONS -DentityExmpansionLimit=4086000 -Djava.awt.headless=true -classpath $PATH_TO_SELF owltools.cli.CommandLineInterface "$@"
if [ $IS_MAC = "TRUE" ]
then
exec "$JAVA" -Xms2G $JVM_OPTIONS -DentityExmpansionLimit=4086000 -Djava.awt.headless=true -classpath "$MY_DIR/owltools-oort-all.jar:$MY_DIR/owltools-runner-all.jar" owltools.cli.CommandLineInterface "$@"
else
exec "$JAVA" -Xms2G $JVM_OPTIONS -DentityExmpansionLimit=4086000 -Djava.awt.headless=true -classpath $PATH_TO_SELF owltools.cli.CommandLineInterface "$@"
fi

exit 1