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

install.sh: introduce Java existance check #401

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
24 changes: 24 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Options:
--prefix /prefix directory prefix (default /usr)
--etcdir /etc specify etc directory path (default /etc)
--nonroot install Scylla without required root priviledge
--packaging use install.sh for packaging
--help this helpful message
EOF
exit 1
Expand All @@ -39,6 +40,7 @@ EOF
root=/
etcdir=/etc
nonroot=false
packaging=false

while [ $# -gt 0 ]; do
case "$1" in
Expand All @@ -58,6 +60,10 @@ while [ $# -gt 0 ]; do
nonroot=true
shift 1
;;
"--packaging")
packaging=true
shift 1
;;
"--help")
shift 1
print_usage
Expand All @@ -68,6 +74,24 @@ while [ $# -gt 0 ]; do
esac
done

if ! $packaging; then
if [ -n "$JAVA_HOME" ]; then
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
if [ -x "$java" ]; then
JAVA="$java"
break
fi
done
else
JAVA=java
fi

if ! builtin command -v $JAVA > /dev/null; then
echo "Please install openjdk-11 before running install.sh."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if user installs, for instance, openjdk-21 and have it in $PATH? and we are not checking for openjdk-11, but a random java executable in the $PATH. so even if this test passes, it does not imply that we have openjdk-11 around.

exit 1
fi
fi

if [ -z "$prefix" ]; then
if $nonroot; then
prefix=~/scylladb
Expand Down