Skip to content

Commit

Permalink
Use POSIX compliant command -v (#498)
Browse files Browse the repository at this point in the history
This removes the `which` package dependency, allowing Linux containers to run with this additional package.
  • Loading branch information
KevinAtSesam authored May 8, 2024
1 parent 671d916 commit 9cb1a51
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/twirl/xerial/sbt/pack/launch.scala.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ case "`uname`" in
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
fi
JAVA_OPTS="$JAVA_OPTS -Xdock:name=\"${PROG_NAME}\" -Xdock:icon=\"$PROG_HOME/@(opts.MAC_ICON_FILE)\" -Dapple.laf.useScreenMenuBar=true"
JAVACMD="`which java`"
JAVACMD="`command -v java`"
;;
esac

# Resolve JAVA_HOME from javac command path
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
javaExecutable="`command -v javac`"
if [ -n "$javaExecutable" -a -f "$javaExecutable" -a ! "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
readLink=`command -v readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
javaExecutable="`readlink -f \"$javaExecutable\"`"
javaHome="`dirname \"$javaExecutable\"`"
Expand All @@ -90,7 +90,7 @@ if [ -z "$JAVACMD" ] ; then
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
JAVACMD="`command -v java`"
fi
fi

Expand Down

0 comments on commit 9cb1a51

Please sign in to comment.