Autodetect JAVA_HOME on RPM-based systems
Author: Matthew Farrellee <matt@redhat.com> Closes #1185 from mattf/master-1 and squashes the following commits: 42150fc [Matthew Farrellee] Autodetect JAVA_HOME on RPM-based systems
This commit is contained in:
parent
133495d826
commit
54055fb2b7
|
@ -84,6 +84,17 @@ while (( "$#" )); do
|
|||
shift
|
||||
done
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
# Fall back on JAVA_HOME from rpm, if found
|
||||
if which rpm &>/dev/null; then
|
||||
RPM_JAVA_HOME=$(rpm -E %java_home 2>/dev/null)
|
||||
if [ "$RPM_JAVA_HOME" != "%java_home" ]; then
|
||||
JAVA_HOME=$RPM_JAVA_HOME
|
||||
echo "No JAVA_HOME set, proceeding with '$JAVA_HOME' learned from rpm"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
echo "Error: JAVA_HOME is not set, cannot proceed."
|
||||
exit -1
|
||||
|
|
Loading…
Reference in a new issue