Skip to content

Commit

Permalink
select-java: try to match $ID_LIKE also
Browse files Browse the repository at this point in the history
there are some distros whose $ID in /etc/os-release does not match
with any of the known distro id in this script, but they do have
`$ID_LIKE` which contains one or more ids which match with the known
distro id, as they are considered the derivatives of the matched
distros. for instance RHEL's ID_LIKE is fedora, and OEL (Oracle
Enterprise Linux)'s ID_LIKE is fedora, Rocky Linux's ID_LIKE is
"rhel centos fedora".

so, in order to find java runtime for these distros, we need to
take ID_LIKE into consideration. in this change, both $ID and $ID_LIKE
are considered, the first matched id wins.

Fixes scylladb#212
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
  • Loading branch information
tchaikov committed May 15, 2023
1 parent f176bcd commit e23b12c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/select-java
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ function select_java_others() {
}

. /etc/os-release
case "$ID" in
for id in $ID $ID_LIKE; do
case "$id" in
ubuntu|debian)
java=$(select_java_debian)
break
;;
fedora|centos)
java=$(select_java_fedora)
break
;;
esac
*)
# not supported? try harder
;;
esac
done

if [ -n "$java" ]; then
: # good
elif [ -x /usr/bin/java ]; then
Expand Down

0 comments on commit e23b12c

Please sign in to comment.